How to use the colortranslator.ColorTranslator function in colortranslator

To help you get started, we’ve selected a few colortranslator 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 celo-org / celo-monorepo / packages / web / src / brandkit / color / Pigment.tsx View on Github external
function Pigment({ hex, name, onCopyHex, justCopied }: Props & ColorData) {
  const inline: ViewStyle = { backgroundColor: hex }

  const cmyk = new ColorTranslator(hex).CMYK.toUpperCase()
    .replace(/%/g, '')
    .replace('K(', 'K (')

  if (hex === colors.white) {
    inline.borderColor = colors.gray
    inline.borderWidth = 1
  }

  const foreGround = getContrastingColor(hex) as colors

  return (

colortranslator

A JavaScript library, written in TypeScript, to convert among different color models

Apache-2.0
Latest version published 6 months ago

Package Health Score

71 / 100
Full package analysis

Popular colortranslator functions