color-fade

1.0.7 • Public • Published
features
  • fade between two colors
  • scatter fade steps as your wanted.
  • get color of the specific point
How is it works
const fadeColor = require('color-fade')
const startingColor = "#66cdaa"
const endingColor = "#ffffff"
const numberOfSteps = 5

const color = await fadeColor(startingColor, endingColor, numberOfSteps)
// [ '#66cdaa', '#8cdabf', '#b3e6d5', '#d9f3ea', '#ffffff' ]

you can get specific point color code

const fadeColor = require('color-fade')
const startingColor = "#66cdaa"
const endingColor = "#ffffff"
const numberOfSteps = 5
const selectColorAt = 3

const color = await fadeColor(startingColor, endingColor, numberOfSteps, selectColorAt)
//'#b3e6d5'

specify output type

  • default it will return as hex

    const fadeColor = require('color-fade') const startingColor = "#66cdaa" const endingColor = "#ffffff" const numberOfSteps = 5 const selectColorAt = 3 const format = 'hex' // 'rgb'

    const color = await fadeColor(startingColor, endingColor, numberOfSteps, selectColorAt, format) //'#b3e6d5'

Package Sidebar

Install

npm i color-fade

Weekly Downloads

1

Version

1.0.7

License

MIT

Unpacked Size

4.33 kB

Total Files

4

Last publish

Collaborators

  • isuru_asp