Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
var colors = stdout.match(/\(.*,.*,.*\)/g)
var isOn = stdout.match(/\] ON /g)
if (isOn && isOn.length > 0) {
settings.on = true
}
if (colors && colors.length > 0) {
// Remove last char )
var str = colors.toString().substring(0, colors.toString().length - 1)
// Remove First Char (
str = str.substring(1, str.length)
const rgbColors = str.split(',').map((item) => {
return item.trim()
})
var converted = convert.rgb.hsv(rgbColors)
settings.color = {
H: converted[0],
S: converted[1],
L: converted[2],
}
}
callback(settings)
})
}
function prepareHandler(text, r, g, b) {
if (typpy(this.text) === "string") {
r = text;
text = this.text;
}
let res = {
color: ""
, text: text
};
if (typpy(r, Array)) {
res.color = colorConvert.rgb.hex(r);
} else if (typpy(r, Number)) {
res.color = colorConvert.rgb.hex(r, g, b);
} else {
res.color = r;
}
return res;
}
function getColor(useLabColors, r, g, b) {
if (useLabColors) {
return convert.rgb.lab(
(r / LUT_DIM_M1) * 255,
(g / LUT_DIM_M1) * 255,
(b / LUT_DIM_M1) * 255
);
}
return [
(r / LUT_DIM_M1) * 255,
(g / LUT_DIM_M1) * 255,
(b / LUT_DIM_M1) * 255
];
}
get value(): Colors {
return {
red: parseInt(this.red, 10),
green: parseInt(this.green, 10),
blue: parseInt(this.blue, 10),
hex: convert.rgb.hex(this.red, this.green, this.blue),
};
};
function setColor(r, g, b) {
var hex;
if (r != null) {
hex = '#' + convert.rgb.hex(r, g, b);
current = convert.rgb.hsl(r, g, b);
} else {
var h = x / window.innerWidth * 360;
var s = 100 - (y / window.innerHeight * 100);
var l = z;
current = [h, s, l];
hex = '#' + convert.hsl.hex(h, s, l);
}
currentHex = hex;
ctx.fillStyle = hex;
ctx.fillRect(0, 0, 16, 16);
link.href = canvas.toDataURL("image/x-icon");
document.title = hex;
if (dark && current[2] >= 40) {
dark = false;
rgb2hsv(hex) {
const rgbhex = hex.slice(0, 6);
const huehex = hex.slice(6, 10);
const sathex = hex.slice(10, 12);
const valhex = hex.slice(12);
const hue = parseInt(huehex, 16);
const sat = parseInt(sathex, 16);
const val = parseInt(valhex, 16);
const hsvc = convert.rgb.hsv(convert.hex.rgb(rgbhex));
const hsv = [hue, sat, val, ...hsvc];
this.debug('Convert color RGB', hex, [rgbhex, huehex, sathex, valhex], ' => HSV', hsv);
return hsv;
}
private calculateHslFromHex(v: string): HueSaturationLightness {
const rgb = convert.hex.rgb(v);
const hsl = convert.rgb.hsl(rgb);
return {
hue: hsl[0] / 360,
saturation: hsl[1] / 100,
lightness: hsl[2] / 100,
}
}
function setColor(r, g, b) {
var hex;
if (r != null) {
hex = '#' + convert.rgb.hex(r, g, b);
current = convert.rgb.hsl(r, g, b);
} else {
var h = x / window.innerWidth * 360;
var s = 100 - (y / window.innerHeight * 100);
var l = z;
current = [h, s, l];
hex = '#' + convert.hsl.hex(h, s, l);
}
currentHex = hex;
ctx.fillStyle = hex;
ctx.fillRect(0, 0, 16, 16);
link.href = canvas.toDataURL("image/x-icon");
document.title = hex;
if (dark && current[2] >= 40) {
dark = false;
div.className = 'xhair dark';
this.setColor = function (r,g,b) {
var hsv = COLORS.rgb.hsv.raw(r,g,b);
this.updateColorChar(hsv[1],r,g,b)
}.bind(this);
this.setRGB = function (r,g,b) {