Skip to content

Commit bf95e55

Browse files
committed
fix: padding bug, add: more colors
1 parent 93d6978 commit bf95e55

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

internal/model/tabs/clustertab/clustertabtable.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ type RowStyle struct{}
7171
type SelectedStyle struct{}
7272

7373
func (h CellStyle) Style(i int, r table.Row) lipgloss.Style {
74-
switch r[i] {
75-
case "down":
74+
switch {
75+
case r[2] == "down":
76+
return styles.TextDarkRed
77+
case i == 2 && r[i] == "allocated":
7678
return styles.TextRed
77-
case "mixed":
79+
case i == 2 && r[i] == "idle":
80+
return styles.TextGreenIdle
81+
case i == 2 && r[i] == "mixed":
7882
return styles.TextOrange
7983
default:
8084
return lipgloss.NewStyle()

internal/styles/styles.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ import (
55
)
66

77
var (
8-
Blue = lipgloss.Color("#0057b7")
9-
Yellow = lipgloss.Color("#ffd700")
10-
Red = lipgloss.Color("#cc0000")
11-
Green = lipgloss.Color("#00b300")
12-
Orange = lipgloss.Color("#FFA500")
8+
Blue = lipgloss.Color("#0057b7")
9+
Yellow = lipgloss.Color("#ffd700")
10+
Red = lipgloss.Color("#cc0000")
11+
DarkRed = lipgloss.Color("#990000")
12+
Green = lipgloss.Color("#00b300")
13+
GreenIdle = lipgloss.Color("#00cc66")
14+
Orange = lipgloss.Color("#FF8000")
1315

1416
Bluegrey = lipgloss.Color("#c2d1f0")
1517

1618
// Generic text color styles
1719
TextRed = lipgloss.NewStyle().Foreground(Red)
20+
TextDarkRed = lipgloss.NewStyle().Foreground(DarkRed)
1821
TextYellow = lipgloss.NewStyle().Foreground(Yellow)
1922
TextGreen = lipgloss.NewStyle().Foreground(Green)
23+
TextGreenIdle = lipgloss.NewStyle().Foreground(GreenIdle)
2024
TextBlue = lipgloss.NewStyle().Foreground(Blue)
2125
TextOrange = lipgloss.NewStyle().Foreground(Orange)
2226
TextBlueGrey = lipgloss.NewStyle().Foreground(Bluegrey)

internal/table/table.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ func (m *Model) renderRow(rowID int) string {
441441
for i, value := range m.rows[rowID] {
442442
style := lipgloss.NewStyle().Width(m.cols[i].Width).MaxWidth(m.cols[i].Width).Inline(true)
443443
overlayedStyle := cellStyles[i].Inherit(rowStyle)
444-
overlayedStyle = overlayedStyle.Copy().Inherit(selStyle)
444+
overlayedStyle = overlayedStyle.Copy().Inherit(selStyle).Padding(0, 1)
445445
//renderedCell := cellStyles[i].Inherit(rowStyle).Render(style.Render(runewidth.Truncate(value, m.cols[i].Width, "…")))
446446
renderedCell := overlayedStyle.Render(style.Render(runewidth.Truncate(value, m.cols[i].Width, "…")))
447447

0 commit comments

Comments
 (0)