Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Commit 796bbf4

Browse files
committed
small size fix and colors added
1 parent 7844cac commit 796bbf4

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

internal/tui/components/logs/table.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/kujtimiihoxha/termai/internal/logging"
1111
"github.com/kujtimiihoxha/termai/internal/pubsub"
1212
"github.com/kujtimiihoxha/termai/internal/tui/layout"
13+
"github.com/kujtimiihoxha/termai/internal/tui/styles"
1314
)
1415

1516
type TableComponent interface {
@@ -122,8 +123,11 @@ func NewLogsTable() TableComponent {
122123
{Title: "Message", Width: 10},
123124
{Title: "Attributes", Width: 10},
124125
}
126+
defaultStyles := table.DefaultStyles()
127+
defaultStyles.Selected = defaultStyles.Selected.Foreground(styles.Primary)
125128
tableModel := table.New(
126129
table.WithColumns(columns),
130+
table.WithStyles(defaultStyles),
127131
)
128132
return &tableCmp{
129133
table: tableModel,

internal/tui/layout/single.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,25 @@ func (s *singlePaneLayout) SetSize(width, height int) {
9393
s.width -= 2
9494
s.height -= 2
9595
}
96+
childWidth, childHeight := s.width, s.height
9697
if s.padding != nil {
9798
if len(s.padding) == 1 {
98-
s.width -= s.padding[0] * 2
99-
s.height -= s.padding[0] * 2
99+
childWidth -= s.padding[0] * 2
100+
childHeight -= s.padding[0] * 2
100101
} else if len(s.padding) == 2 {
101-
s.width -= s.padding[0] * 2
102-
s.height -= s.padding[1] * 2
102+
childWidth -= s.padding[0] * 2
103+
childHeight -= s.padding[1] * 2
103104
} else if len(s.padding) == 3 {
104-
s.width -= s.padding[0] * 2
105-
s.height -= s.padding[1] + s.padding[2]
105+
childWidth -= s.padding[0] * 2
106+
childHeight -= s.padding[1] + s.padding[2]
106107
} else if len(s.padding) == 4 {
107-
s.width -= s.padding[0] + s.padding[2]
108-
s.height -= s.padding[1] + s.padding[3]
108+
childWidth -= s.padding[0] + s.padding[2]
109+
childHeight -= s.padding[1] + s.padding[3]
109110
}
110111
}
111112
if s.content != nil {
112113
if c, ok := s.content.(Sizeable); ok {
113-
c.SetSize(s.width, s.height)
114+
c.SetSize(childWidth, childHeight)
114115
}
115116
}
116117
}

internal/tui/styles/styles.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var (
1818
Border = Regular.Border(lipgloss.NormalBorder())
1919
ThickBorder = Regular.Border(lipgloss.ThickBorder())
2020
DoubleBorder = Regular.Border(lipgloss.DoubleBorder())
21+
2122
// Colors
2223

2324
Surface0 = lipgloss.AdaptiveColor{
@@ -118,4 +119,7 @@ var (
118119
Dark: dark.Peach().Hex,
119120
Light: light.Peach().Hex,
120121
}
122+
123+
Primary = Blue
124+
Secondary = Mauve
121125
)

0 commit comments

Comments
 (0)