Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Ucbepic Docetl ThemeContext

From Leeroopedia
Revision as of 17:02, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Ucbepic_Docetl_ThemeContext.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Frontend, React_UI
Last Updated 2026-02-08 00:00 GMT

Overview

Concrete tool for the theme context provider that manages color scheme theming across the DocETL playground.

Description

The ThemeContext module defines a React context for managing application-wide color themes. It supports six themes (default, forest, majestic, sunset, ruby, monochrome), each defined as a complete set of HSL CSS custom property values for backgrounds, foregrounds, cards, popovers, primary/secondary/muted/accent colors, borders, charts, and destructive states. The ThemeProvider component persists the selected theme to localStorage, applies CSS custom properties to the document root on theme change, and initializes from saved preferences on mount.

Usage

Wraps the application at the root level to provide theme context. Individual components use the useTheme hook to read or change the current theme.

Code Reference

Source Location

Signature

export type Theme = "default" | "forest" | "majestic" | "sunset" | "ruby" | "monochrome";

interface ThemeContextType {
  theme: Theme;
  setTheme: (theme: Theme) => void;
}

export const ThemeProvider: React.FC<{ children: React.ReactNode }>
export const useTheme: () => ThemeContextType

Import

import { ThemeProvider, useTheme } from "@/contexts/ThemeContext";

I/O Contract

Inputs (Props)

Name Type Required Description
children React.ReactNode Yes Child components to provide theme context to

Outputs

Name Type Description
context ThemeContextType Theme value and setter function

Usage Examples

// In _app or layout:
<ThemeProvider>
  <App />
</ThemeProvider>

// In any component:
const { theme, setTheme } = useTheme();
setTheme("forest");

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment