From 5a0a8f12e4cd2137badf8e2063c0ab3e3ff2f5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B0=D0=BD=D0=B8=D1=81=D0=BB=D0=B0=D0=B2?= Date: Wed, 14 Jun 2023 17:02:27 +0300 Subject: [PATCH] Fix for styles (#2112) * Show correct error when loading skins. * Fix wrong color reference for dracula theme --- internal/ui/config.go | 14 ++++++++++++-- skins/dracula.yml | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/internal/ui/config.go b/internal/ui/config.go index 23a6c195..c655be0f 100644 --- a/internal/ui/config.go +++ b/internal/ui/config.go @@ -2,7 +2,9 @@ package ui import ( "context" + "errors" "fmt" + "os" "path/filepath" "github.com/derailed/k9s/internal/config" @@ -131,14 +133,22 @@ func (c *Configurator) RefreshStyles(context string) { c.Styles.Reset() } if err := c.Styles.Load(clusterSkins); err != nil { - log.Warn().Msgf("No context specific skin file found -- %s", clusterSkins) + if errors.Is(err, os.ErrNotExist) { + log.Warn().Msgf("No context specific skin file found -- %s", clusterSkins) + } else { + log.Error().Msgf("Failed to parse context specific skin file -- %s. %s.", clusterSkins, err) + } } else { c.updateStyles(clusterSkins) return } if err := c.Styles.Load(config.K9sStylesFile); err != nil { - log.Warn().Msgf("No skin file found -- %s. Loading stock skins.", config.K9sStylesFile) + if errors.Is(err, os.ErrNotExist) { + log.Warn().Msgf("No skin file found -- %s. Loading stock skins.", config.K9sStylesFile) + } else { + log.Error().Msgf("Failed to parse skin file -- %s. %s. Loading stock skins.", config.K9sStylesFile, err) + } c.updateStyles("") return } diff --git a/skins/dracula.yml b/skins/dracula.yml index 41ca3b0a..6df70e8a 100644 --- a/skins/dracula.yml +++ b/skins/dracula.yml @@ -112,4 +112,4 @@ k9s: fgColor: *foreground bgColor: *purple toggleOnColor: *green - toggleOffColor: *blue \ No newline at end of file + toggleOffColor: *cyan \ No newline at end of file