Explorar o código

Generate random colors in HSL for better visual diff

Kirk Trombley %!s(int64=3) %!d(string=hai) anos
pai
achega
ef210e7f4c
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      web/listeners.js

+ 1 - 1
web/listeners.js

@@ -137,7 +137,7 @@ const onColorChanged = (state, newValue) => {
 };
 
 const onRandomColor = state => {
-  const color = rgb2hex([Math.random(), Math.random(), Math.random()].map(c => c * 255));
+  const color = d3.hsl(Math.random() * 360, Math.random(), Math.random()).formatHex();
   document.getElementById("color-input").value = color;
   onColorChanged(state, color); // triggers rescore
 };