Explorar el Código

Randomize initial color for markers to give more variation

Kirk Trombley hace 3 años
padre
commit
fc36ce436b
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      client/src/hooks/useMarkersFromGuesses/getColorGenerator.js

+ 2 - 2
client/src/hooks/useMarkersFromGuesses/getColorGenerator.js

@@ -2,8 +2,8 @@
 // https://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
 const goldenRatioConj = 0.618033988749895;
 
-const getColorGenerator = () => {
-  let h = 0;
+const getColorGenerator = (hInit = null) => {
+  let h = hInit ?? Math.random();
   const nextColor = () => {
     const h6 = h * 6;
     h += goldenRatioConj;