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 Apr 14, 2023
1 parent e029866 commit b75b48b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions output.go
Expand Up @@ -67,6 +67,7 @@ func NewOutput(tty io.Writer, opts ...OutputOption) *Output {
tty: tty,
environ: &osEnviron{},
Profile: -1,
cache: true,
fgSync: &sync.Once{},
fgColor: NoColor{},
bgSync: &sync.Once{},
Expand Down

0 comments on commit b75b48b

Please sign in to comment.