MCPcopy Create free account
hub / github.com/dulapahv/CodeX / getSystemPreference

Function getSystemPreference

apps/client/lib/init-editor-theme.ts:78–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76
77// Function to check system preference for dark mode
78const getSystemPreference = (): "dark" | "light" => {
79 if (typeof window === "undefined") {
80 return "dark"; // Default for SSR
81 }
82
83 return window.matchMedia?.("(prefers-color-scheme: dark)").matches
84 ? "dark"
85 : "light";
86};
87
88// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: theme initialization handles many CSS variable mappings
89export const initEditorTheme = () => {

Callers 1

initEditorThemeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected