diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-02-08 17:56:20 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-02-08 17:56:20 +0200 |
| commit | dd4667f71d750f6e612c04fa62de9317340cf1f4 (patch) | |
| tree | b8ee28c088f6bbe3650f4f5b1a2cbb0b59bf5236 /internal | |
| parent | 1f793312bee5da4e53b9727d2685e8fdeba649fe (diff) | |
User settings colors are now runtime-friendly
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/client/ui/core/usersettings/usersettings.go | 17 | ||||
| -rw-r--r-- | internal/client/ui/field/field.go | 10 |
2 files changed, 15 insertions, 12 deletions
diff --git a/internal/client/ui/core/usersettings/usersettings.go b/internal/client/ui/core/usersettings/usersettings.go index 83ff56c..e5c518a 100644 --- a/internal/client/ui/core/usersettings/usersettings.go +++ b/internal/client/ui/core/usersettings/usersettings.go @@ -54,21 +54,24 @@ func New() Model { headerStyle := lipgloss.NewStyle().Foreground(colors.Turquoise) - baseStyle := lipgloss.NewStyle().Inline(true). + blurredTextStyle := lipgloss.NewStyle(). Background(colors.Background).Foreground(colors.White) - _ = baseStyle + focusedTextStyle := blurredTextStyle.Foreground(colors.Focus) + fieldBlurredStyle := lipgloss.NewStyle().Width(width). PaddingLeft(1).Border(lipgloss.RoundedBorder()). - BorderBackground(colors.Background).BorderForeground(colors.DarkCyan) - // Background(colors.Background).Foreground(colors.White) - fieldFocusedStyle := fieldBlurredStyle.Border(lipgloss.ThickBorder()). - BorderBackground(colors.Background).BorderForeground(colors.Focus) + BorderBackground(colors.Background).BorderForeground(colors.DarkCyan). + Background(colors.Background) + fieldFocusedStyle := fieldBlurredStyle. + Border(lipgloss.ThickBorder()).BorderForeground(colors.Focus) name := field.New(width) name.Header = "Username" name.HeaderStyle = headerStyle name.FocusedStyle = fieldFocusedStyle name.BlurredStyle = fieldBlurredStyle + name.FocusedTextStyle = focusedTextStyle + name.BlurredTextStyle = blurredTextStyle name.ErrorStyle = lipgloss.NewStyle().Foreground(colors.Error) name.Input.CharLimit = width name.Focus() @@ -86,6 +89,8 @@ func New() Model { description.HeaderStyle = headerStyle description.FocusedStyle = fieldFocusedStyle description.BlurredStyle = fieldBlurredStyle + description.FocusedTextStyle = focusedTextStyle + description.BlurredTextStyle = blurredTextStyle description.ErrorStyle = lipgloss.NewStyle().Foreground(colors.Error) description.Input.CharLimit = width description.Input.SetValue(user.Description) diff --git a/internal/client/ui/field/field.go b/internal/client/ui/field/field.go index fb55f1e..b9cbca9 100644 --- a/internal/client/ui/field/field.go +++ b/internal/client/ui/field/field.go @@ -86,9 +86,8 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { func (m *Model) Focus() tea.Cmd { m.Input.PromptStyle = m.FocusedTextStyle m.Input.TextStyle = m.FocusedTextStyle - m.Input.Cursor.Style = lipgloss.NewStyle() - // Background(m.FocusedTextStyle.GetForeground()). - // Foreground(m.FocusedTextStyle.GetBackground()) + m.Input.Cursor.Style = m.FocusedTextStyle + m.Input.Cursor.TextStyle = m.FocusedTextStyle return m.Input.Focus() } @@ -96,9 +95,8 @@ func (m *Model) Blur() { m.Input.Blur() m.Input.PromptStyle = m.BlurredTextStyle m.Input.TextStyle = m.BlurredTextStyle - // m.Input.Cursor.Style = lipgloss.NewStyle(). - // Background(m.BlurredTextStyle.GetForeground()). - // Foreground(m.BlurredTextStyle.GetBackground()) + m.Input.Cursor.Style = m.BlurredTextStyle + m.Input.Cursor.TextStyle = m.BlurredTextStyle } func (m *Model) SetWidth(width int) { |
