Skip to content

OldDream/color-lighten-tool

Repository files navigation

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

Code Sandbox

Or Check demo.html in Git for more detail .

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published