Skip to main content

detect_theme_mode_once

Function detect_theme_mode_once 

Source
pub fn detect_theme_mode_once()
Expand description

Probe the terminal once for its background color and cache the result. Call this exactly once, before the ratatui terminal guard takes over stdout. Idempotent: subsequent calls are no-ops.

On detection failure (non-TTY, query unsupported, timeout) the cache is set to ThemeMode::Dark, which matches the most common dev-terminal configuration.