style upgrades
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
export type ChromeColorScheme = "light" | "dark";
|
||||
|
||||
export const CHROME_COLORS: Record<
|
||||
ChromeColorScheme,
|
||||
{ base: string; dimmed: string }
|
||||
> = {
|
||||
light: { base: "#ffffff", dimmed: "#999999" },
|
||||
dark: { base: "#242424", dimmed: "#161616" },
|
||||
};
|
||||
|
||||
export function setThemeColorMeta(color: string): void {
|
||||
if (typeof document === "undefined") return;
|
||||
|
||||
const metas = document.querySelectorAll<HTMLMetaElement>(
|
||||
'meta[name="theme-color"]'
|
||||
);
|
||||
|
||||
if (metas.length === 0) {
|
||||
const meta = document.createElement("meta");
|
||||
meta.name = "theme-color";
|
||||
meta.content = color;
|
||||
document.head.appendChild(meta);
|
||||
return;
|
||||
}
|
||||
|
||||
metas.forEach((meta) => meta.setAttribute("content", color));
|
||||
}
|
||||
Reference in New Issue
Block a user