Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

831 : Update theme setting logic to include instance where theme is set to 'system' instead of 'dark' or 'light' to prevent using light theme variables in dark mode (#878)

Hunter Wiginton23e4d48103f9
diff --git a/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-editor.tsx b/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-editor.tsx
index a779d945..bef1f802 100644
--- a/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-editor.tsx
+++ b/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-editor.tsx
@@ -80,9 +80,9 @@ export function SolutionEditor({ dismiss, challenge }: Props) {
};
const { theme } = useTheme();
- theme === 'dark'
- ? document.documentElement.setAttribute('data-color-mode', 'dark')
- : document.documentElement.setAttribute('data-color-mode', 'light');
+ theme != null
+ ? document.documentElement.setAttribute('data-color-mode', theme)
+ : document.documentElement.setAttribute('data-color-mode', 'system');
return (
<Form {...form}>