Skip to content

Node JS Minimalist Library for making colorful terminal experiences (v2.0.0 Released).

License

Notifications You must be signed in to change notification settings

TECHOUS/rainbowjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rainbowjs logo

Rainbow JS

Node/Deno JS Minimalist Library for making colorful terminal experiences.

GitHub release (latest by date) GitHub package.json version GitHub code size in bytes GitHub last commit npm

Features

  • Minimalist library to add colors to terminal
  • No need to learn hexadecimal color codes
  • Print alphabets on terminal easily using Alphabet library
  • Supports Deno JS from GitHub and NPM registry
  • Smallest library to build terminal based JS Games

Installation

yarn add @techous/rainbowjs
# or
npm install @techous/rainbowjs

Quick Setup

For quickly using this library you can follow the below commands

# clone the repository
git clone https://github.com/TechOUs/rainbowjs.git

# After this you will get a folder (js module) that you can use in your project

Core Usage

We support the core Rainbow Library for nodejs and denojs mainly

Node JS

// Method 1 : Create Rainbow module object to access the functions
const Rainbow = require('@techous/rainbowjs');
// Use Rainbow.<METHOD>
console.log(Rainbow.checkFormat('blink'));
// OUTPUT : true

// Method 2 : Use function names directly which you want to import
const {checkFormat} = require('#techous/rainbowjs');
console.log(checkFormat('blink'));
// OUTPUT : true

Deno JS

// Method 1: Use code directly from github
import {
    checkFormat
} from 'https://raw.githubusercontent.com/TechOUs/rainbowjs/master/src/deno/index.js'
console.log(checkFormat('blink'));
// OUTPUT : true

// Method 2: Use code from npm package cdn
import {
    checkFormat
} from 'https://cdn.skypack.dev/@techous/rainbowjs/deno';
console.log(checkFormat('blink'));
// OUTPUT : true

Alphabet Library Support (Supported from 2.0.0)

We added this new library in version 2.0.0 to print the Alphabets easily on the terminal that reduces the time to print the alphabets again and again

Node JS

// Method 1 : Create Rainbow module object to access the functions
const Alphabet = require('@techous/rainbowjs/Alphabet');
// Use Alphabet.<METHOD>
Alphabet.printString('#', 'Tests', '  ');
// OUTPUT
// #####   ###    ##   #    ##
//   #    #   #  #    ###  #
//   #    #####   #    #    #
//   #    #        #   #     #
//   #     ####  ##    ##  ##

// Method 2 : Use function names directly which you want to import
const {printString} = require('@techous/rainbowjs/Alphabet');
printString('#', 'Tests', '  ');
// OUTPUT
// #####   ###    ##   #    ##
//   #    #   #  #    ###  #
//   #    #####   #    #    #
//   #    #        #   #     #
//   #     ####  ##    ##  ##

Deno JS

// Method 1 : Use the code directly from github
import {
    getString, 
    printString
} from 'https://raw.githubusercontent.com/TechOUs/rainbowjs/master/src/deno/Alphabet.js'
printString('#', 'Tests', '  ');
// OUTPUT
// #####   ###    ##   #    ##
//   #    #   #  #    ###  #
//   #    #####   #    #    #
//   #    #        #   #     #
//   #     ####  ##    ##  ##

// Method 2 : Using npm cdn 
import {
    getString,
    printString
} from 'https://cdn.skypack.dev/@techous/rainbowjs/deno/Alphabet.js'
printString('#', 'Tests', '  ');
// OUTPUT
// #####   ###    ##   #    ##
//   #    #   #  #    ###  #
//   #    #####   #    #    #
//   #    #        #   #     #
//   #     ####  ##    ##  ##

Documentation

Coming Soon!

Contribution

For contribution guidelines please follow this guide

LICENSE

GitHub