Quick Start
Installation
Import & Use
Import
import colorsea from 'colorsea'
const colorsea = require('colorsea')
<script src="path/to/colorsea.js"></script>
Color space conversion
colorsea('#ff0000').rgb()
colorsea('#ff0000', 50).rgba()
const color = colorsea('#405060')
color.rgba()
color.xyz()
color.lab()
colorsea.xyz(7.09, 7.67, 12.17).rgb()
colorsea.hsl(210, 20, 31.37).rgb()
Color operations
const color = colorsea('#ffffff')
const newColor = color.darken(10)
newColor.hex()
colorsea('#000').lighten(10).hex()
colorsea('#ff0000').spin(180).hex()
colorsea.hsl(80, 90, 20).saturate(10).hsl()
colorsea.hsl(80, 90, 20).desaturate(10).hsl()
colorsea('#776600').fadeOut(10).rgba()
const color1 = new Color('#ff0000')
const color2 = new Color('#0000ff')
const color = color1.mix(color2, 20)
color.hex()
Color difference calculation
const color1 = colorsea.lab(80, 30, 120)
const color2 = colorsea.lab(79, 28, 100)
color1.deltaE(color2, 'CMC')
color1.deltaE(color2, 'CMC', { l: 2 })
color1.deltaE(color2, 'CIE2000')
color1.deltaE(color2, 'CIE1994')
color1.deltaE(color2, 'CIE1976')
Use color names
import colorsea from 'colorsea'
import x11 from 'colorsea/colors/x11'
colorsea.useNames(x11)
colorsea('Aqua')
colorsea('Aquamarine')
import chinese from 'colorsea/colors/chinese'
import nippon from 'colorsea/colors/nippon'
colorsea.useNames(chinese).useNames(nippon)
colorsea('山梗紫')
colorsea('水がき')