color picker fixes, random default color

This commit is contained in:
jonaswinkler committed 2021-02-25 22:43:45 +01:00
1 parent ba478c6cbb
commit 66fe821b04
4 files changed
+25 -9

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
function componentToHex(c) {
var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex;
}
export function randomColor() {
let r = Math.floor(Math.random() * 150) + 50
let g = Math.floor(Math.random() * 150) + 50
let b = Math.floor(Math.random() * 150) + 50
return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`
}