Skip to content

Commit fc01cec

Browse files
committed
refactor: route ThemeContext color-scheme through isLightThemeMode
Replace the inline `theme === "light" || theme === "flexoki-light"` check in `getColorScheme` with the shared `isLightThemeMode` helper from `shiki-shared.ts`, so the `-light` suffix convention has a single source of truth and stays consistent with the syntax-highlighting call sites that already use it.
1 parent d2e53f6 commit fc01cec

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/browser/contexts/ThemeContext.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import React, {
1010
} from "react";
1111
import { readPersistedString, usePersistedState } from "@/browser/hooks/usePersistedState";
1212
import { UI_THEME_KEY } from "@/common/constants/storage";
13+
import { isLightThemeMode } from "@/browser/utils/highlighting/shiki-shared";
1314

1415
export type ThemeMode = "light" | "dark" | "flexoki-light" | "flexoki-dark";
1516
export type ThemePreference = ThemeMode | "auto";
@@ -74,7 +75,8 @@ const FAVICON_BY_SCHEME: Record<"light" | "dark", string> = {
7475

7576
/** Map theme mode to CSS color-scheme value */
7677
function getColorScheme(theme: ThemeMode): "light" | "dark" {
77-
return theme === "light" || theme === "flexoki-light" ? "light" : "dark";
78+
// Reuse the shared `-light` suffix convention so we have one source of truth for the light/dark mapping.
79+
return isLightThemeMode(theme) ? "light" : "dark";
7880
}
7981

8082
function applyThemeFavicon(theme: ThemeMode) {

0 commit comments

Comments
 (0)