How to use rgb-hex - 5 common examples

To help you get started, we’ve selected a few rgb-hex 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 algolia / marvel-search / lib / utils / helper-marvel-website.js View on Github external
// We find the line defining the `rgbString`
    let matchingLine = _.find(lines, (line) => {
      return _.startsWith(line, 'var rgbString');
    });

    // We parse it
    let rgbString = matchingLine.replace(/(.*)"(.*)"(.*)/, '$2');
    let split = _.map(rgbString.split(','), _.toInteger);
    if (split.length !== 3) {
      return null;
    }
    let red = split[0];
    let green = split[1];
    let blue = split[2];
    let hexa = rgb2hex(red, green, blue).toUpperCase();
    return {
      red, green, blue, hexa
    };
  }
};
github microlinkhq / www / src / theme / Colors.stories.js View on Github external
const toHex = color =>
  (isHexColor(color) ? color : `#${rgbHex(color)}`).toLowerCase()
github datocms / plugins / star-rating-editor / src / index.jsx View on Github external
const toHex = ({
  red,
  green,
  blue,
  alpha,
}) => `#${rgbHex(red, green, blue, alpha / 255)}`;
github jsmecham / atom-terminal-tab / lib / theme-matcher.js View on Github external
Array.from(this.colorElements.children).forEach((colorElement) => {
      const colorKey = colorElement.dataset.colorKey;
      const computedStyle = getComputedStyle(colorElement);
      colors[colorKey] = `#${rgbHex(computedStyle.color)}`;
    });
github postcss / postcss-color-rgba-fallback / index.js View on Github external
var value = valueParser(decl.value).walk(function(node) {
        var nodes = node.nodes
        if (node.type === "function" && node.value === "rgba") {
          try {
            alpha = parseFloat(nodes[6].value)
            RGB = calculateRGB(backgroundColor, [
              parseInt(nodes[0].value, 10),
              parseInt(nodes[2].value, 10),
              parseInt(nodes[4].value, 10),
              alpha,
            ])
            hex = rgbToHex.apply(null, RGB)
            node.type = "word"
            node.value = "#" + hex
          }
          catch (e) {
            return false
          }
          return false
        }
      }).toString()

rgb-hex

Convert RGB(A) color to HEX

MIT
Latest version published 8 months ago

Package Health Score

66 / 100
Full package analysis

Popular rgb-hex functions