How to use color-name-list - 1 common examples

To help you get started, weโ€™ve selected a few color-name-list examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shariati / cherangi / index.js View on Github external
module.exports = function (hexcolor) {
  hexcolor = stringToHex(hexcolor)
  const rgbColor = hexToRGB(hexcolor)
  const cieLabColor = rgbToCIELab(rgbColor)
  const matchedColor = []
  colors.forEach(element => {
    const hexValue = stringToHex(element.hex)
    const rgbValue = hexToRGB(hexValue)
    const cieLabValue = rgbToCIELab(rgbValue)
    element.cieLab = cieLabValue
    if (matchColor(cieLabColor, element).status > 0) {
      matchedColor.push(matchColor(cieLabColor, element))
    }
  })

  const matched = matchedColor.reduce((prevColor, currentColor) => (prevColor.delta < currentColor.delta) ? prevColor : currentColor)
  return matched
}

color-name-list

long list of color names

MIT
Latest version published 1 month ago

Package Health Score

89 / 100
Full package analysis

Popular color-name-list functions