0.2.0 • Published 4 years ago

lolcolor v0.2.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
4 years ago

lolcolor

Turn anything into a color!

Install

If you are using lolcolor in javascript code, a simple install will add it to your dependencies.

npm install lolcolor

If this is getting bundled into front-end javascript, you might want to install into your devDependencies instead.

npm install -D lolcolor

If requiring easy use via command-line, install globally.

npm install -g lolcolor

If not running often, consider using npx instead of a global install.

npx lolcolor "Hey now, you're an all star"

Usage

Command Line

lolcolor can be used from the command line.

lolcolor "get your game on, go play"

Function

The simplest way to use lolcolor in code is as a simple function.

const lolcolor = require('lolcolor');

const text = 'Hey now, you\'re a rock star';

console.log(lolcolor(text));

ColorBuilder

If you need a bit more control over your colors you can use the ColorBuilder.

const { ColorBuilder } = require('lolcolor');

const builderText = 'get the show on, get paid';

const colorBuilder = new ColorBuilder();

const [colorR, colorG, colorB] = colorBuilder.fromString(builderText).asRgb().butOnly64Colors().create();

console.log(`Red value:${colorR}, Green value:${colorG}, Blue value:${colorB}`);
CategoryMethodParametersDescription
BeginfromStringsourceThe input text
Createcreate(none)Output your color
Color modeasHex(none)Use hex color mode
Color modeasHsl(none)Use HSL color mode
Color modeasRgb(none)Use RGB color mode
Color limitbutOnly8Colors(none)Only choose from 8 colors
Color limitbutOnly64Colors(none)Only choose from 64 colors (6-bit)
Color limitbutOnly256Colors(none)Only choose from 256 colors