function rgbToHsv(rgb) { const [r, g, b] = rgb.map(value => value / 255); const v = Math.max(r, g, b); const min = Math.min(r, g, b); const delta = v - min; const s = v === 0 ? 0 : delta / v; let h = 0; const getRes = (h, s, v) => [Math.round(h), Math.round(s * 100), Math.round(v * 100)]; if (s === 0) return getRes(h, s, v); if (v === r) { h = (g - b) / delta; } else if (v === g) { h = 2 + (b - r) / delta; } else { h = 4 + (r - g) / delta; } h *= 60; if (h < 0) h += 360; return getRes(h, s, v); }
- function rgbToHsv(rgb) {
- const [r, g, b] = rgb.map(value => value / 255);
- const v = Math.max(r, g, b);
- const min = Math.min(r, g, b);
- const delta = v - min;
- const s = v === 0 ? 0 : delta / v;
- let h = 0;
if (s !== 0) {if (v === r) {h = (g - b) / delta;} else if (v === g) {h = 2 + (b - r) / delta;} else {h = 4 + (r - g) / delta;}h *= 60;if (h < 0) h += 360;- const getRes = (h, s, v) => [Math.round(h), Math.round(s * 100), Math.round(v * 100)];
- if (s === 0) return getRes(h, s, v);
- if (v === r) {
- h = (g - b) / delta;
- } else if (v === g) {
- h = 2 + (b - r) / delta;
- } else {
- h = 4 + (r - g) / delta;
- }
- h *= 60;
- if (h < 0) h += 360;
return [Math.round(h), Math.round(s * 100), Math.round(v * 100)];- return getRes(h, s, v);
- }
function rgbToHsv(rgb) { let [r, g, b] = rgb; const v = Math.max(r, g, b) / 255; if (v == 0) return Array.of(0, 0, 0); r /= v, g /= v, b /= v; const s = 1 - Math.min(r, g, b) / 255; if (s == 0) return Array.of(0, 0, v * 100); r = 255 - (255 - r) / s; g = 255 - (255 - g) / s; b = 255 - (255 - b) / s; const peak = Math.max(r, g, b); let h = 0; if (r == peak) h = g < b ? 360 - b * 60 / 255 : g * 60 / 255; else if (g == peak) h = r > b ? 120 - r * 60 / 255 : 120 + b * 60 / 255; else h = r > g ? 240 + r * 60 / 255 : 240 - g * 60 / 255; return Array.of(Math.round(h), Math.round(s * 100), Math.round(v * 100)); }
- function rgbToHsv(rgb) {
let r = rgb[0], g = rgb[1], b = rgb[2];- let [r, g, b] = rgb;
- const v = Math.max(r, g, b) / 255;
- if (v == 0) return Array.of(0, 0, 0);
r /= v;g /= v;b /= v;- r /= v, g /= v, b /= v;
- const s = 1 - Math.min(r, g, b) / 255;
- if (s == 0) return Array.of(0, 0, v * 100);
- r = 255 - (255 - r) / s;
- g = 255 - (255 - g) / s;
- b = 255 - (255 - b) / s;
- const peak = Math.max(r, g, b);
- let h = 0;
- if (r == peak) h = g < b ? 360 - b * 60 / 255 : g * 60 / 255;
- else if (g == peak) h = r > b ? 120 - r * 60 / 255 : 120 + b * 60 / 255;
- else h = r > g ? 240 + r * 60 / 255 : 240 - g * 60 / 255;
- return Array.of(Math.round(h), Math.round(s * 100), Math.round(v * 100));
- }
const helloWorld = (world) => world ? `Hello World baby` : `No World`;
/*def hello_world(world):if world == True:return "Hello World baby"elif world == False:return "No World"*/// helloWorld = (world) => world == true ? 'Hello World baby': 'No World';const helloWorld=(world)=>world==true?`Hello World baby`:`No World`;- const helloWorld = (world) => world ? `Hello World baby` : `No World`;