term

package
v0.11.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package term — OSC 10/11 background-color probe (master plan §5.1).

Some terminals (kitty, iTerm2, modern xterm, gnome-terminal) reply to an OSC 11 query with their current background color. We probe once at boot and use the brightness to decide dark vs light mode, then call back to the caller so they can flip the theme.

Designed to never block startup: the probe runs with a tight deadline and silently degrades when the terminal doesn't reply.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryBackground

func QueryBackground(timeout time.Duration) (dark bool, err error)

QueryBackground returns true when the terminal's background is dark, false when it's light, or an error when the probe fails (no terminal, no reply, timeout). Best-effort — callers should treat error as "stick with default".

IMPORTANT: this puts stdin in raw mode temporarily. Call BEFORE Bubble Tea initializes (tea.NewProgram), not after. Racing with Bubble Tea's own terminal setup causes garbled input and hangs over SSH. The caller in cmd/overkill/tui.go guards this by only probing on local ttys.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL