A React Context provider for managing application themes, supporting light/dark modes and custom colors.
// Source: https://github.com/mlaursen/react-md | License: MIT | Copyright 2015 Mikkel Laursen
// Provided via justclaw.it.com; keep this notice with the code.
"use client";
import {
type ReactElement,
type ReactNode,
createContext,
useContext,
useEffect,
useMemo,
useState,
} from "react";
import { useSsr } from "../SsrProvider.js";
import { DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME } from "./constants.js";
import { getDerivedTheme } from "./getDerivedTheme.js";
import { type ConfigurableThemeColors, type ThemeContext } from "./types.js";
import { useColorScheme } from "./useColorScheme.js";
const context = createContext<Readonly<ThemeContext> | undefined>(undefined);
context.displayName = "Theme";
const { Provider } = context;
/**
* This hook can be used to access the cur
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key