termbg

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package termbg decides the terminal's background color for Lip Gloss before Bubble Tea can ask the terminal itself.

Bubble Tea v1 queries the terminal in a package init (tea_init.go: "make sure Lip Gloss and Termenv query the terminal before any Bubble Tea Program runs") whenever stdout is a terminal. Termenv waits up to OSCTimeout, five seconds, for the answer. Terminals that never answer OSC 11 (the Linux console, some IDE and serial terminals, a few multiplexer setups) therefore stalled every zn command, `zn --version` included, for five seconds, and the belated answer could land in the next thing reading stdin, such as the `zn setup` prompt.

Go initializes packages in import-path order among those whose imports are ready, and github.com/ZenNotes sorts before github.com/charmbracelet, so this package's init runs after Lip Gloss's and before Bubble Tea's. Presetting the answer here makes that init a no-op; the two places that want the real answer, the terminal app's auto theme and `zn read --pretty`, call Detect and ask the terminal deliberately.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect() bool

Detect asks the terminal on stdout once and remembers the answer, also for Lip Gloss's default renderer. It must run before Bubble Tea owns the terminal; it is the one place zn pays for the query, and only when the caller needs the real background.

func Guess

func Guess(colorFGBG string) bool

Guess is the answer without asking the terminal: what COLORFGBG says (rxvt, Konsole and others export it as "fg;bg"), else dark, the same fallback termenv uses when a query goes unanswered.

Types

This section is empty.

Jump to

Keyboard shortcuts

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