From 452975b1f758a46684e2ee06742e03f28164cf85 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 6 Apr 2023 17:39:20 -0400 Subject: [PATCH 1/2] fix(output): use withcolorcache on the default output --- output.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output.go b/output.go index e22d369..1b0ab4e 100644 --- a/output.go +++ b/output.go @@ -8,7 +8,7 @@ import ( var ( // output is the default global output. - output = NewOutput(os.Stdout) + output = NewOutput(os.Stdout, WithColorCache(true)) ) // File represents a file descriptor. From 948656871e127ba51e4a1727279d41260587eb1d Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Wed, 3 May 2023 14:00:35 -0400 Subject: [PATCH 2/2] fix(output): lazy cache colors whenever they are requested We don't need to cache the fg/bg colors when we instantiate a termenv.Output, instead, lazy cache the colors whenever they're requested. --- output.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/output.go b/output.go index 1b0ab4e..92536f0 100644 --- a/output.go +++ b/output.go @@ -105,10 +105,6 @@ func WithProfile(profile Profile) OutputOption { func WithColorCache(v bool) OutputOption { return func(o *Output) { o.cache = v - - // cache the values now - _ = o.ForegroundColor() - _ = o.BackgroundColor() } }