Skip to content

Commit 593de54

Browse files
committed
refactor(config | tui): add default border color for reusability
1 parent abf3298 commit 593de54

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

internal/config/style.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ import (
1515
"github.com/museslabs/kyma/internal/tui/transitions"
1616
)
1717

18+
const (
19+
DefaultBorderColor = "#9999CC"
20+
)
21+
1822
type Properties struct {
1923
Title string `yaml:"title"`
2024
Style StyleConfig `yaml:"style"`
@@ -89,8 +93,7 @@ func (s *StyleConfig) UnmarshalYAML(bytes []byte) error {
8993
}
9094

9195
func (s StyleConfig) Apply(width, height int) SlideStyle {
92-
defaultBorderColor := "#9999CC" // Blueish
93-
borderColor := defaultBorderColor
96+
borderColor := DefaultBorderColor
9497

9598
if s.Theme.Style.H1.BackgroundColor != nil {
9699
borderColor = *s.Theme.Style.H1.BackgroundColor
@@ -101,7 +104,7 @@ func (s StyleConfig) Apply(width, height int) SlideStyle {
101104
}
102105

103106
if s.BorderColor == "default" {
104-
borderColor = defaultBorderColor
107+
borderColor = DefaultBorderColor
105108
}
106109

107110
style := s.Layout.

internal/tui/command.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import (
99
"github.com/charmbracelet/bubbles/list"
1010
tea "github.com/charmbracelet/bubbletea"
1111
"github.com/charmbracelet/lipgloss"
12+
"github.com/museslabs/kyma/internal/config"
1213
)
1314

1415
var (
1516
titleStyle = lipgloss.NewStyle()
1617
itemStyle = lipgloss.NewStyle().
1718
PaddingLeft(2)
1819
selectedItemStyle = lipgloss.NewStyle().
19-
Foreground(lipgloss.Color("#9999CC"))
20+
Foreground(lipgloss.Color(config.DefaultBorderColor))
2021
paginationStyle = list.DefaultStyles().PaginationStyle.
2122
PaddingLeft(2)
2223
helpStyle = list.DefaultStyles().HelpStyle.
@@ -183,7 +184,7 @@ func (m Command) Show(slideView string, width, height int) string {
183184
Width(90).
184185
Height(15).
185186
Padding(0, 4, 0, 4).
186-
BorderForeground(lipgloss.Color("#9999CC")).
187+
BorderForeground(lipgloss.Color(config.DefaultBorderColor)).
187188
Render(view)
188189

189190
_, modalWidth := getLines(modalContent)

0 commit comments

Comments
 (0)