parent
03f0d5a00e
commit
465c947517
|
|
@ -866,8 +866,13 @@ k9s:
|
||||||
valueColor: royalblue
|
valueColor: royalblue
|
||||||
# Logs styles.
|
# Logs styles.
|
||||||
logs:
|
logs:
|
||||||
fgColor: white
|
fgColor: lightskyblue
|
||||||
bgColor: black
|
bgColor: black
|
||||||
|
indicator:
|
||||||
|
fgColor: dodgerblue
|
||||||
|
bgColor: black
|
||||||
|
toggleOnColor: limegreen
|
||||||
|
toggleOffColor: gray
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,8 @@ type (
|
||||||
LogIndicator struct {
|
LogIndicator struct {
|
||||||
FgColor Color `yaml:"fgColor"`
|
FgColor Color `yaml:"fgColor"`
|
||||||
BgColor Color `yaml:"bgColor"`
|
BgColor Color `yaml:"bgColor"`
|
||||||
|
ToggleOnColor Color `yaml:"toggleOnColor"`
|
||||||
|
ToggleOffColor Color `yaml:"toggleOffColor"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Yaml tracks yaml styles.
|
// Yaml tracks yaml styles.
|
||||||
|
|
@ -369,6 +371,8 @@ func newLogIndicator() LogIndicator {
|
||||||
return LogIndicator{
|
return LogIndicator{
|
||||||
FgColor: "dodgerblue",
|
FgColor: "dodgerblue",
|
||||||
BgColor: "black",
|
BgColor: "black",
|
||||||
|
ToggleOnColor: "limegreen",
|
||||||
|
ToggleOffColor: "gray",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package view
|
package view
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/derailed/k9s/internal/config"
|
"github.com/derailed/k9s/internal/config"
|
||||||
|
|
@ -47,6 +48,7 @@ func NewLogIndicator(cfg *config.Config, styles *config.Styles, allContainers bo
|
||||||
func (l *LogIndicator) StylesChanged(styles *config.Styles) {
|
func (l *LogIndicator) StylesChanged(styles *config.Styles) {
|
||||||
l.SetBackgroundColor(styles.K9s.Views.Log.Indicator.BgColor.Color())
|
l.SetBackgroundColor(styles.K9s.Views.Log.Indicator.BgColor.Color())
|
||||||
l.SetTextColor(styles.K9s.Views.Log.Indicator.FgColor.Color())
|
l.SetTextColor(styles.K9s.Views.Log.Indicator.FgColor.Color())
|
||||||
|
l.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
// AutoScroll reports the current scrolling status.
|
// AutoScroll reports the current scrolling status.
|
||||||
|
|
@ -111,36 +113,39 @@ func (l *LogIndicator) reset() {
|
||||||
func (l *LogIndicator) Refresh() {
|
func (l *LogIndicator) Refresh() {
|
||||||
l.reset()
|
l.reset()
|
||||||
|
|
||||||
|
toggleOnFormat := "[::b]%s:[" + string(l.styles.K9s.Views.Log.Indicator.ToggleOnColor) + "::b]On[-::] %s"
|
||||||
|
toggleOffFormat := "[::b]%s:[" + string(l.styles.K9s.Views.Log.Indicator.ToggleOffColor) + "::d]Off[-::]%s"
|
||||||
|
|
||||||
if l.shouldDisplayAllContainers {
|
if l.shouldDisplayAllContainers {
|
||||||
if l.allContainers {
|
if l.allContainers {
|
||||||
l.indicator = append(l.indicator, "[::b]AllContainers:[limegreen::b]On[-::] "+spacer...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOnFormat, "AllContainers", spacer)...)
|
||||||
} else {
|
} else {
|
||||||
l.indicator = append(l.indicator, "[::b]AllContainers:[gray::d]Off[-::]"+spacer...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOffFormat, "AllContainers", spacer)...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.AutoScroll() {
|
if l.AutoScroll() {
|
||||||
l.indicator = append(l.indicator, "[::b]Autoscroll:[limegreen::b]On[-::] "+spacer...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOnFormat, "Autoscroll", spacer)...)
|
||||||
} else {
|
} else {
|
||||||
l.indicator = append(l.indicator, "[::b]Autoscroll:[gray::d]Off[-::]"+spacer...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOffFormat, "Autoscroll", spacer)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.FullScreen() {
|
if l.FullScreen() {
|
||||||
l.indicator = append(l.indicator, "[::b]FullScreen:[limegreen::b]On[-::] "+spacer...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOnFormat, "FullScreen", spacer)...)
|
||||||
} else {
|
} else {
|
||||||
l.indicator = append(l.indicator, "[::b]FullScreen:[gray::d]Off[-::]"+spacer...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOffFormat, "FullScreen", spacer)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.Timestamp() {
|
if l.Timestamp() {
|
||||||
l.indicator = append(l.indicator, "[::b]Timestamps:[limegreen::b]On[-::] "+spacer...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOnFormat, "Timestamps", spacer)...)
|
||||||
} else {
|
} else {
|
||||||
l.indicator = append(l.indicator, "[::b]Timestamps:[gray::d]Off[-::]"+spacer...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOffFormat, "Timestamps", spacer)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.TextWrap() {
|
if l.TextWrap() {
|
||||||
l.indicator = append(l.indicator, "[::b]Wrap:[limegreen::b]On[-::] "...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOnFormat, "Wrap", "")...)
|
||||||
} else {
|
} else {
|
||||||
l.indicator = append(l.indicator, "[::b]Wrap:[gray::d]Off[-::]"...)
|
l.indicator = append(l.indicator, fmt.Sprintf(toggleOffFormat, "Wrap", "")...)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = l.Write(l.indicator)
|
_, _ = l.Write(l.indicator)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue