mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
color picker fixes, random default color
This commit is contained in:
12
src-ui/src/app/utils/color.ts
Normal file
12
src-ui/src/app/utils/color.ts
Normal 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)}`
|
||||
}
|
Reference in New Issue
Block a user