refactor: use tailwind custom colors for themes
Use tailwind v4 @theme block so we can use bg-layer-0 instead of bg-[--layer-0] for theme colors.
This commit is contained in:
@@ -244,7 +244,7 @@
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: var(--layer-2);
|
||||
background: var(--color-layer-2);
|
||||
opacity: 0;
|
||||
}
|
||||
input:disabled {
|
||||
@@ -264,8 +264,8 @@
|
||||
border-radius: 5px;
|
||||
width: calc(100% - 20px);
|
||||
height: calc(100% - 25px);
|
||||
border: dashed 4px var(--layer-2);
|
||||
background: var(--layer-1);
|
||||
border: dashed 4px var(--color-layer-2);
|
||||
background: var(--color-layer-1);
|
||||
opacity: 0.5;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -14,7 +14,7 @@ const variables = [
|
||||
|
||||
function getColor(variable: (typeof variables)[number]) {
|
||||
const style = getComputedStyle(document.body.parentElement!);
|
||||
const color = style.getPropertyValue(`--${variable}`);
|
||||
const color = style.getPropertyValue(`--color-${variable}`);
|
||||
return new Color().setStyle(color, LinearSRGBColorSpace);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ $effect.root(() => {
|
||||
if (!appSettings.value.theme || !('getComputedStyle' in globalThis)) return;
|
||||
const style = getComputedStyle(document.body.parentElement!);
|
||||
for (const v of variables) {
|
||||
const hex = style.getPropertyValue(`--${v}`);
|
||||
const hex = style.getPropertyValue(`--color-${v}`);
|
||||
colors[v].setStyle(hex, LinearSRGBColorSpace);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user