2.0.3 • Published 2 years ago

string-color-converter v2.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

ColorConverter("color")

How to use...

View Demo

codesandbox link - usase guide

codesandbox link - view example code

gitHub link - download sourcecode

How to install

npm install string-color-converter

html - js

import ColorConverter from "string-color-converter";

node:

const ColorConverter = require('string-color-converter');

syntax :

ColorConverter( strColorValue )

output :

returns object having following read-only properties
PropertyDescription < ColorObject >
.nameName of color defined in css3
.rgbString rgb color value
.rgbaString rgba color value
.hexString Hexa code of color
.hexaString Hexa code of color with alpha value
.hslString HSL color
.hslaString HSL color with alpha value
.rNumeric Red Value
.gNumeric Green Value
.bNumeric Blue Value
.aNumeric Alpha Value Floating Point
.hNumeric Hue Value
.sNumeric Saturation Value
.lNumeric Lightness Value
.strString that is passed for conversion of color
.isValidtrue if passed string is valid color string or valid html colorName.

Other Methods

This library have following methods

import ColorConverter, {hsv2hsl, hsl2hsv, rgb2hsl, hsl2rgb, hex2rgb, str2rgb, rgb2hex, rgba2hexa} from "string-color-converter";
MethodDescription
hsv2hslaccept {hue, saturation, value} and return {hue, saturation, lightness}
hsl2hsvaccept {hue, saturation, lightness} and return { hue, saturation, value}
rgb2hslaccept {red, green, blue} and return {hue, saturation, lightness}
hsl2rgbaccept {hue, saturation, lightness} and return {red, green, blue}
hex2rgbaccept #RRGGBB and return {red, green, blue}
str2rgbaccept rgb() string color value and return {red, green, blue}
str2hslaccept hsl() string color value and return {hue, saturation, lightness}
rgb2hexaccept {red, green, blue} and return #RRGGBB
rgba2hexaaccept {red, green, blue, alpha} and return #RRGGBBAA

License : Free to use

Author

developergovindgupta

(Govind Prasad Gupta)

email: govindprasadguptamca@gmail.com