Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} 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();
};
rgbaString: function() {
return string.rgbaString(this.values.rgb, this.values.alpha);
},
percentString: function() {
rgbaString: function () {
return string.rgbaString(this.values.rgb, this.values.alpha);
},
percentString: function () {
rgbaString: function () {
return string.rgbaString(this.values.rgb, this.values.alpha);
},
percentString: function () {
rgbaString: function() {
return string.rgbaString(values.rgb, values.alpha);
},
percentString: function() {
rgbaString: function() {
return string.rgbaString(this.values.rgb, this.values.alpha);
},
percentString: function() {
rgbaString: function () {
return string.rgbaString(this.values.rgb, this.values.alpha);
},
percentString: function () {
rgbaString: function() {
return string.rgbaString(this.values.rgb, this.values.alpha);
},
percentString: function() {
rgbaString: function () {
return string.rgbaString(this.values.rgb, this.values.alpha);
},
percentString: function () {