Skip to documentation

Design system / Sources & standards

Current repository source

colorModeProvider.tsx

src/components/colorMode/colorModeProvider.tsx

This view contains the escaped source read during the deployment build. Code and policy text are unchanged. Markdown is shown as source, not rendered as a document. A new deployment refreshes the content.

"use client";

import { useState, type ReactNode } from "react";
import { ThemeProvider } from "next-themes";
import { ColorModePreviewControlContext, type ColorMode } from "./useColorMode";

/** Browser presentation only. Session and tenant branding stay server-owned. */
export function ColorModeProvider({ children }: { children: ReactNode }) {
  const [previewMode, setPreviewMode] = useState<ColorMode | null>(null);
  return (
    <ColorModePreviewControlContext.Provider value={setPreviewMode}>
    <ThemeProvider attribute="class" storageKey="cxh-color-mode" defaultTheme="light"
      themes={["light", "dark"]} enableSystem={false} enableColorScheme={false}
      forcedTheme={previewMode ?? undefined}>
      {children}
    </ThemeProvider>
    </ColorModePreviewControlContext.Provider>
  );
}
All sources and standards
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.