Skip to content
/ safolor Public

💾 🎨 Convert colors to 8-bit web-safe colors

License

Notifications You must be signed in to change notification settings

pagyew/safolor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@pagyew/safolor

npm version npm downloads bundle JSDocs License

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