diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-02-09 17:11:50 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-02-09 17:11:50 +0200 |
| commit | a16d17c02007a9b8c1457b5d92e073329001cf7f (patch) | |
| tree | ead1b7085e9dfbca89e908c1c1be8ab991100b1f /internal/client | |
| parent | 9e4dba2743fbfbdfe9debaa83d310eb8c7b4ebd9 (diff) | |
Ban view colors are now runtime-friendly
Diffstat (limited to 'internal/client')
| -rw-r--r-- | internal/client/ui/core/banview/banview.go | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/internal/client/ui/core/banview/banview.go b/internal/client/ui/core/banview/banview.go index 51636f1..a6ff91b 100644 --- a/internal/client/ui/core/banview/banview.go +++ b/internal/client/ui/core/banview/banview.go @@ -11,17 +11,7 @@ import ( "github.com/kyren223/eko/pkg/snowflake" ) -var ( - width = 48 - - style = lipgloss.NewStyle(). - Border(lipgloss.ThickBorder()). - Padding(1, 4). - Align(lipgloss.Center, lipgloss.Center) - - headerStyle = lipgloss.NewStyle().Foreground(colors.Focus) - grayStyle = lipgloss.NewStyle().Foreground(colors.LightGray) -) +var width = 48 const ( BanReasonField = iota @@ -48,15 +38,36 @@ func (m Model) Init() tea.Cmd { } func (m Model) View() string { + headerStyle := lipgloss.NewStyle(). + Width(width). + Background(colors.Background). + Foreground(colors.Focus) + grayStyle := lipgloss.NewStyle(). + Width(width). + Background(colors.Background). + Foreground(colors.LightGray) + nameHeader := headerStyle.Render("Banned Username:") name := m.name + grayStyle.Render(" ("+m.id+")") - name = lipgloss.NewStyle().Width(width).Render(name) + name = lipgloss.NewStyle(). + Width(width). + Background(colors.Background). + Render(name) banReasonHeader := headerStyle.Render("Ban Reason:") banReason := lipgloss.NewStyle().Width(width).Render(m.banReason) content := flex.NewVertical(nameHeader, name, banReasonHeader, banReason).WithGap(1).View() - return style.Render(content) + + return lipgloss.NewStyle(). + Border(lipgloss.ThickBorder()). + Padding(1, 4). + Align(lipgloss.Center, lipgloss.Center). + BorderBackground(colors.Background). + BorderForeground(colors.White). + Background(colors.Background). + Foreground(colors.White). + Render(content) } func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { |
