Skip to content

Commit

Permalink
fix(output): cache bg and fg colors by default
Browse files Browse the repository at this point in the history
It's uncommon for users to change the colorscheme of their terminal from
a dark to light, or vice versa, while a program is running. This makes
Termenv query the terminal for colors too many times.

Enable color caching by default and give the program the option to
opt-out using WithColorCache(false).
  • Loading branch information
aymanbagabas committed Aug 26, 2023
1 parent 3b3da4b commit 4fa0a49
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions output.go
Expand Up @@ -69,6 +69,7 @@ func NewOutput(w io.Writer, opts ...OutputOption) *Output {
w: w,
environ: &osEnviron{},
Profile: -1,
cache: true,
fgSync: &sync.Once{},
fgColor: NoColor{},
bgSync: &sync.Once{},
Expand Down

0 comments on commit 4fa0a49

Please sign in to comment.