color-lighten-tool
v1.0.2
Published
Make color lighten, like add opacity and white background.
Downloads
13
Maintainers
Readme
color-lighten-tool
Output = Input color * opacity + white background
Language : English | 中文
📦 UMD module
& ESModule
, offer .d.ts
file to support Typescript.
Install
npm i color-lighten-tool
API
function colorLightenTool(color: string, opacity: number): string
import colorLightenTool from 'color-lighten-tool'
const outPutColor = colorLightenTool('rgb(255,0,0)', 0.4) // rgb(255,153,153)
const outPutColor = colorLightenTool('#FF0000', 0.4) // rgb(255,153,153)
For advanced users, you can pass a color to replace white background.
function colorLightenTool(color: string, opacity: number[, bgColor: {r: number, g: number, b: number}]): string
Output = Input color * opacity + custom background color
DEMO
Or Check demo.html
in Git for more detail .