Lighten
Methods available are: rgb
, hsv
/value
, hsl
/lightness
, hsi
/intensity
, hsp
/perceived
, cmyk
, and cmyk2
/black
. rgb
and cmyk
modify all values.
These methods are intended to provide alternative ways of modifying a color versus changing the values directly, which can make more sense.
.modify('lighten', {
amount: number, // optional, 0 - 1, defaults to 0.5
method: string, // optional, defaults to the original type or 'hsl' if type not directly supported
round: boolean, // optional, defaults to true
})
JavaScriptโ
const Color = require('chromaticity-color-utilities')
const color1 = Color.from('rgb', [255, 0, 255, 200]).modify('lighten', {
method: 'lightness',
})
// rgb { r: 255, g: 128, b: 255, a: 200, bitDepth: 8, max: 255 }
const color2 = Color.from('rgb', [100, 0, 100]).modify('lighten', {
method: 'hsp',
amount: 0.5
})
// rgb { r: 250, g: 0, b: 250, a: 255, bitDepth: 8, max: 255 }
TypeScriptโ
import Color from 'chromaticity-color-utilities'
const color1: Color.rgb[] = Color.from('rgb', [255, 0, 255, 200])
.modify('lighten', { method: 'lightness' })