Convert colors to 8-bit web-safe colors
This package is designed to be used as
devDependencies
and bundled into your dist.
npm i @pagyew/safolor
import { safolor } from '@pagyew/safolor'
Shortcut for safolor.hex()
Accepts a color in HEX or RGB format and returns a safecolor in HEX format
safolor.hex('#123456') // #003366
Accepts a color in HEX or RGB format and returns a safecolor in RGB format
safolor.rgb('#123456') // rgb(0, 51, 102)
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 }
MIT License © 2024-PRESENT Vladislav Tsepilov