@linktime/palette
v1.0.2
Published
Color converter and generator.
Downloads
10
Readme
@linktime/palette
JavaScript Util library to convert color and generate color.
Install
$ npm install @linktime/palette
Usage
import palette from '@linktime/palette'
// Generate 20 colors from default colors
const colors = palette(20)
Examples
$ npm run example
Open http://127.0.0.1:8080/example/
Generate colors, convert hex color to hsl color
import palette, { hex2hsl } from '@linktime/palette'
// Generate 20 colors from default colors
const colors = palette(20)
const hslColor = hex2hsl('#ffffff') // Output hsl(0, 0%, 100%)
Generate colors from default colors, control color lightness
import palette from '@linktime/palette'
// Generate 30 lighter colors from default colors
const colors = palette(30, 0.1, ['#1d121c', '#232323', '#23456f'])
// Generate 30 darker colors from default colors
const colors = palette(30, -0.1, ['#dddddd', '#eeeeee', '#dedede'])
Generate colors from your colors
import palette from '@linktime/palette'
// Generate 20 colors from default colors
const colors = palette(20, 0.1, ['#1d121c', '#232323', '#23456f'])
check Test folder for more examples.
Test
$ npm run test
TODO
Use alogrithm to generate color scheme