瀏覽代碼

Generate random colors in HSL for better visual diff

Kirk Trombley 3 年之前
父節點
當前提交
ef210e7f4c
共有 1 個文件被更改,包括 1 次插入1 次删除
  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
 };