npm.io
0.1.1 • Published 3 years ago

dls-color-palette

Licence
MIT
Version
0.1.1
Deps
1
Size
82 kB
Vulns
0
Weekly
0
Stars
25

dls-color-palette

To generate a color palette out of the given base color.

Installation

npm i --save-dev dls-color-palette

Usage

Get color shade

function getShade(color: string, level: number): string

Params:

  • color: string - the brand color in hex format.
  • level: number - level of the color shade. Valid range: [1, 10]

Return Value:

  • Color of the given level in hex format.
import { getShade } from 'dls-color-palette'
const shade = getShade('#0052cc', 2) // → #e0edff
Get contextual color according to the given brand color

function getContextual(color: string, type: string): string

Params:

  • color: string - the brand color in hex format.
  • type: 'info' | 'success' | 'warning' | 'error' - type of the contextual color.

Return Value:

  • Contextual color in hex format.
import { getContextual } from 'dls-color-palette'
const contextual = getContextual('#0052cc', 'success') // → #00bf5c

Keywords