Fix for styles (#2112)
* Show correct error when loading skins. * Fix wrong color reference for dracula thememine
parent
248f7bc56c
commit
5a0a8f12e4
|
|
@ -2,7 +2,9 @@ package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/derailed/k9s/internal/config"
|
"github.com/derailed/k9s/internal/config"
|
||||||
|
|
@ -131,14 +133,22 @@ func (c *Configurator) RefreshStyles(context string) {
|
||||||
c.Styles.Reset()
|
c.Styles.Reset()
|
||||||
}
|
}
|
||||||
if err := c.Styles.Load(clusterSkins); err != nil {
|
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 {
|
} else {
|
||||||
c.updateStyles(clusterSkins)
|
c.updateStyles(clusterSkins)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.Styles.Load(config.K9sStylesFile); err != nil {
|
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("")
|
c.updateStyles("")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,4 +112,4 @@ k9s:
|
||||||
fgColor: *foreground
|
fgColor: *foreground
|
||||||
bgColor: *purple
|
bgColor: *purple
|
||||||
toggleOnColor: *green
|
toggleOnColor: *green
|
||||||
toggleOffColor: *blue
|
toggleOffColor: *cyan
|
||||||
Loading…
Reference in New Issue