How to use text-hex - 1 common examples

To help you get started, we’ve selected a few text-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 sebinsua / tap-debug / src / colorify.js View on Github external
'use strict';

var pluralize = require('pluralize');

var colors;
try {
  var hex = require('text-hex');
  var crayon = require('@ccheever/crayon');
  colors = {
    hex: hex.bind(hex),
    crayon: crayon.bind(crayon)
  };
} catch (_) {
  colors = false;
}

var GET_VARIABLE_NAMES_REGEX = /\$\{([A-Za-z_0-9]+)\}/g;

function createGetVariablesRegex(variables) {
  return new RegExp('(' + variables.map(function (v) {
    return '\\$\\{' + v + '\\}';
  }).join('|') + ')', 'g');
}

function createGetWordsRegex(words) {
  return new RegExp('(' + words.join('|') + ')', 'g');

text-hex

Generate a hex color from the given text

MIT
Latest version published 6 years ago

Package Health Score

68 / 100
Full package analysis

Popular text-hex functions