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.

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 (
    <View style={[standardStyles.elementalMarginBottom, brandStyles.gap, styles.container]}>
      <Hoverable onPress={onCopyHex}>
        {(isHovering: boolean) => (
          <View style={styles.box}>
            <View

colortranslator

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

Apache-2.0
Latest version published 13 days ago

Package Health Score

69 / 100
Full package analysis

Popular colortranslator functions