💄 Updates colors for metrics chart

This commit is contained in:
Rune Harlyk
2025-07-10 21:34:20 +02:00
committed by Rune Harlyk
parent d529eaa201
commit d0aa3b7b42
2 changed files with 40 additions and 38 deletions
+4 -2
View File
@@ -1,4 +1,6 @@
export const daisyColor = (name: string, opacity: number = 100) => {
const color = getComputedStyle(document.documentElement).getPropertyValue(name);
return `oklch(${color} / ${opacity}%)`;
const color = getComputedStyle(document.documentElement).getPropertyValue(name).trim();
if (opacity >= 100) return color;
const alpha = Math.min(Math.max(opacity, 0), 100) / 100;
return `${color.replace(/(\/\s*\d+(\.\d+)?\))|\)$/, '')} / ${alpha})`;
};