From b75b48bd7ab87bac9d42250d63542cfbbe1939cf 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 e22d369..6fa57cf 100644 --- a/output.go +++ b/output.go @@ -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{},