Skip to content

Commit 4fa0a49

Browse files
committed
fix(output): cache bg and fg colors by default
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).
1 parent 3b3da4b commit 4fa0a49

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

output.go

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func NewOutput(w io.Writer, opts ...OutputOption) *Output {
6969
w: w,
7070
environ: &osEnviron{},
7171
Profile: -1,
72+
cache: true,
7273
fgSync: &sync.Once{},
7374
fgColor: NoColor{},
7475
bgSync: &sync.Once{},

0 commit comments

Comments
 (0)