MCPcopy
hub / github.com/cli/cli / DetectTerminalTheme

Method DetectTerminalTheme

pkg/iostreams/iostreams.go:116–130  ·  view source on GitHub ↗

DetectTerminalTheme is a utility to call before starting the output pager so that the terminal background can be reliably detected.

()

Source from the content-addressed store, hash-verified

114// DetectTerminalTheme is a utility to call before starting the output pager so that the terminal background
115// can be reliably detected.
116func (s *IOStreams) DetectTerminalTheme() {
117 if !s.ColorEnabled() || s.pagerProcess != nil {
118 s.terminalTheme = "none"
119 return
120 }
121
122 style := os.Getenv("GLAMOUR_STYLE")
123 if style != "" && style != "auto" {
124 // ensure GLAMOUR_STYLE takes precedence over "light" and "dark" themes
125 s.terminalTheme = "none"
126 return
127 }
128
129 s.terminalTheme = s.term.Theme()
130}
131
132// TerminalTheme returns "light", "dark", or "none" depending on the background color of the terminal.
133func (s *IOStreams) TerminalTheme() string {

Callers 11

TerminalThemeMethod · 0.95
viewRunFunction · 0.80
listRunFunction · 0.80
viewRunFunction · 0.80
longPagerFunction · 0.80
viewRunFunction · 0.80
viewRunFunction · 0.80
viewRunFunction · 0.80
renderAllFilesFunction · 0.80
viewRunFunction · 0.80
runViewFunction · 0.80

Calls 2

ColorEnabledMethod · 0.95
ThemeMethod · 0.65

Tested by

no test coverage detected