added theme and gradients and stuff

This commit is contained in:
David Meincke
2022-03-24 23:00:10 +01:00
parent 5fb596daae
commit cda1b5c972
17 changed files with 225 additions and 51 deletions
+7 -2
View File
@@ -38,6 +38,11 @@ export function executeDrawQueue(): void {
renderCanvas.executeDrawQueue();
}
export function getRandomColor(randomOpacity: boolean = true): string {
return "rgba(" + getRandom(0,255) + ", " + getRandom(0,255) + ", " + getRandom(0,255) + ", " + (randomOpacity ? Math.random() + 0.1 : "1") + ")";
export function getRandomColor(): string {
var prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)");
var from = prefersDarkScheme.matches ? 127 : 0;
var to = prefersDarkScheme.matches ? 255 : 127;
return "rgba(" + getRandom(from,to) + ", " + getRandom(from,to) + ", " + getRandom(from,to) + ", " + ("1") + ")";
}