@pagyew/safolor
v0.2.1
Published
Convert colors to 8-bit web-safe colors
Downloads
9
Readme
@pagyew/safolor
Convert colors to 8-bit web-safe colors
This package is designed to be used as
devDependencies
and bundled into your dist.
Installation
npm i @pagyew/safolor
Usage
import { safolor } from '@pagyew/safolor'
safolor(color: HEX | RGB): HEX
Shortcut for safolor.hex()
.hex(color: HEX | RGB): HEX
Accepts a color in HEX or RGB format and returns a safecolor in HEX format
safolor.hex('#123456') // #003366
.rgb(color: HEX | RGB): RGB
Accepts a color in HEX or RGB format and returns a safecolor in RGB format
safolor.rgb('#123456') // rgb(0, 51, 102)
.rgbObj(color: HEX | RGB): RGBObject
Accepts a color in HEX or RGB format and returns a safecolor's values in RGB object
safolor.rgbObj('#123456') // { r: 0, g: 51, b: 102 }
License
MIT License © 2024-PRESENT Vladislav Tsepilov