themes lol
This commit is contained in:
@@ -8,6 +8,24 @@ export const CHROME_COLORS: Record<
|
||||
dark: { base: "#242424", dimmed: "#161616" },
|
||||
};
|
||||
|
||||
// theme-color meta ownership: while a drawer holds a dimmed color, base
|
||||
// writes (from scheme/theme changes) must not overwrite it.
|
||||
let dimmedDepth = 0;
|
||||
|
||||
export function setBaseThemeColor(color: string): void {
|
||||
if (dimmedDepth === 0) setThemeColorMeta(color);
|
||||
}
|
||||
|
||||
export function pushDimmedThemeColor(color: string): void {
|
||||
dimmedDepth++;
|
||||
setThemeColorMeta(color);
|
||||
}
|
||||
|
||||
export function popDimmedThemeColor(base: string): void {
|
||||
dimmedDepth = Math.max(0, dimmedDepth - 1);
|
||||
if (dimmedDepth === 0) setThemeColorMeta(base);
|
||||
}
|
||||
|
||||
export function setThemeColorMeta(color: string): void {
|
||||
if (typeof document === "undefined") return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user