How to use the color-string.rgbaString function in color-string

To help you get started, we’ve selected a few color-string 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 stoyan / csscolormin / index.js View on Github external
} else {
    var colour = color(c);
  }
  var alpha = colour.values.alpha;
  var rgb = colour.values.rgb;

  if (rgb[0] === 0 && rgb[1] === 0 && rgb[2] === 0 && alpha === 0) {
    return 'transparent';
  }

  if (alpha !== 1) {
    // no choice, gotta be rgba
    if (alpha < 1) {
      alpha = String(alpha).replace('0.', '.');
    }
    return string
      .rgbaString(rgb, alpha)
      .replace(/ /g, '')
      .toLowerCase();
  }

  // hex, short hex, or keyword
  var hex = colour.hexString();
  if (hex[1] === hex[2] && hex[3] === hex[4] && hex[5] === hex[6]) {
    hex = ['#', hex[1], hex[3], hex[5]].join('');
  }
  var word = colour.keyword();
  if (!word || hex.length < word.length) {
    return hex.toLowerCase();
  }
  return word.toLowerCase();
};
github SmallImprovements / jquery.smallimap / js / contrib / color-0.4.1.js View on Github external
rgbaString: function() {
      return string.rgbaString(this.values.rgb, this.values.alpha);
   },
   percentString: function() {
github shama / button-styles / bundle.js View on Github external
rgbaString: function () {
		return string.rgbaString(this.values.rgb, this.values.alpha);
	},
	percentString: function () {
github decentraland / editor-legacy / node_modules / color / index.js View on Github external
rgbaString: function () {
		return string.rgbaString(this.values.rgb, this.values.alpha);
	},
	percentString: function () {
github awemulya / kobo-predict / uis_r_us / static / js / libs / color.js View on Github external
rgbaString: function() {
         return string.rgbaString(values.rgb, values.alpha);
      },
      percentString: function() {
github Qix- / color / color-0.5.0.js View on Github external
rgbaString: function() {
      return string.rgbaString(this.values.rgb, this.values.alpha);
   },
   percentString: function() {
github Qix- / color / index.js View on Github external
rgbaString: function () {
		return string.rgbaString(this.values.rgb, this.values.alpha);
	},
	percentString: function () {
github tessera-metrics / tessera / tessera / static / js / color-0.7.1.js View on Github external
rgbaString: function() {
      return string.rgbaString(this.values.rgb, this.values.alpha);
   },
   percentString: function() {
github sx1989827 / DOClever / Client / node_modules / color / index.js View on Github external
rgbaString: function () {
		return string.rgbaString(this.values.rgb, this.values.alpha);
	},
	percentString: function () {