Skip to main content

set_theme_detector

Function set_theme_detector 

Source
pub fn set_theme_detector(detector: fn() -> ColorMode)
Expand description

Overrides the detector used to determine whether the user prefers a light or dark theme.

This is useful for testing or when you want to force a specific color mode.

ยงExample

use standout::{ColorMode, set_theme_detector};

// Force dark mode for testing
set_theme_detector(|| ColorMode::Dark);

// Reset to OS detection (if needed)
// Note: There's no direct way to reset to OS detection,
// but tests should restore their changes.