From 9065ca31d05fa7c9dc2a8073f5a534a55dc860f5 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Fri, 7 Feb 2025 17:21:48 +0200 Subject: Networklist colors are now runtime-friendly --- internal/client/ui/core/networklist/networklist.go | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'internal/client/ui/core') diff --git a/internal/client/ui/core/networklist/networklist.go b/internal/client/ui/core/networklist/networklist.go index 2e6b970..16afda1 100644 --- a/internal/client/ui/core/networklist/networklist.go +++ b/internal/client/ui/core/networklist/networklist.go @@ -12,16 +12,6 @@ import ( "github.com/kyren223/eko/internal/packet" ) -var ( - sepStyle = lipgloss.NewStyle().Width(0).BorderBackground(colors.BackgroundDimmer). - Border(lipgloss.ThickBorder(), false, true, false, false) - - selectedIndicator = "šŸ­€\nā–Œ\nšŸ­›" - notification = " \nā——\n " - - backgroundStyle = lipgloss.NewStyle().Background(colors.BackgroundDimmer) -) - const SignalsIndex = -1 type Model struct { @@ -45,6 +35,12 @@ func (m Model) Init() tea.Cmd { } func (m Model) View() string { + selectedIndicator := lipgloss.NewStyle(). + Foreground(colors.White).Render("šŸ­€\nā–Œ\nšŸ­›") + + notification := lipgloss.NewStyle(). + Foreground(colors.White).Render(" \nā——\n ") + var builder strings.Builder pings := 0 @@ -123,13 +119,16 @@ func (m Model) View() string { result := builder.String() - sep := sepStyle.Height(ui.Height) + sep := lipgloss.NewStyle().Width(0).Height(ui.Height). + BorderBackground(colors.BackgroundDimmer).BorderForeground(colors.White). + Border(lipgloss.ThickBorder(), false, true, false, false) if m.focus { sep = sep.BorderForeground(colors.Focus) } + result = lipgloss.JoinHorizontal(lipgloss.Top, result, sep.String()) - return backgroundStyle.Render(result) + return lipgloss.NewStyle().Background(colors.BackgroundDimmer).Render(result) } func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { -- cgit v1.3.1