Takes a hexidecimal color string and returns the rgb value
Basic usage example:
const colors = require('stringman').colors; // or `import {colors} from 'stringman'`;
const test = colors.hexToRgb('#16212c');
console.log(test); // [22, 33, 44]
Takes a string and returns boolean indicating whether it is a valid hexidecimal color
Basic usage example:
const colors = require('stringman').colors; // or `import {colors} from 'stringman'`;
const valid = colors.isHex('16212c');
const invalid = colors.isHex('nope');
console.log(valid); // true
console.log(invalid); // false
Takes a hex color value and a percentage and returns a hex color string that is the result of lightening or darkening the original color by the percentage NOTE: this does not work on black or white!
Basic usage example:
const colors = require('stringman').colors; // or `import {colors} from 'stringman'`;
const lightened = colors.luminance('#63C6FF', 40);
const darkened = colors.luminance('#63C6FF', -40);
console.log(lightened); // '#8affff'
console.log(darkened); // '#3b7699'
Takes rgb color values and returns hexidecimal equivalent
Basic usage example:
const colors = require('stringman').colors; // or `import {colors} from 'stringman'`;
const test = colors.rgbToHex(22, 33, 44);
console.log(test); // '#16212C'
Takes r, g, and b and numbers in 3 separate agurments, convert to hsl, and returns in object with h, s, and l as keys
Basic usage example:
const colors = require('stringman').colors; // or `import {colors} from 'stringman'`;
const toHsl = colors.rgbToHSL(99, 198, 255);
console.log(toHsl); // {h: 201.9, s: '100%', l: '69.4%'}
Generated using TypeDoc
Takes a hex color string and returns a string array with hex color converted to HSL [H, S, L]
Basic usage example: