MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / detect

Function detect

crates/openshell-tui/src/theme.rs:198–210  ·  view source on GitHub ↗
(mode: ThemeMode)

Source from the content-addressed store, hash-verified

196/// temporarily enters raw mode itself and restores it afterward.
197#[must_use]
198pub fn detect(mode: ThemeMode) -> Theme {
199 match mode {
200 ThemeMode::Dark => Theme::dark(),
201 ThemeMode::Light => Theme::light(),
202 ThemeMode::Auto => {
203 if is_light_terminal() {
204 Theme::light()
205 } else {
206 Theme::dark()
207 }
208 }
209 }
210}
211
212/// Detect whether the terminal has a light background using OSC 11.
213///

Callers 2

runFunction · 0.85
detect_explicit_modesFunction · 0.85

Calls 1

is_light_terminalFunction · 0.85

Tested by 1

detect_explicit_modesFunction · 0.68