From 4fa0a49e92a837c307d10893fff9304272e38d1d Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Fri, 14 Apr 2023 16:22:56 -0400 Subject: [PATCH] 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). --- output.go | 1 + 1 file changed, 1 insertion(+) diff --git a/output.go b/output.go index ebe48fe..ac7abab 100644 --- a/output.go +++ b/output.go @@ -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{},