mirror of
https://github.com/IllusionMan1212/gorc.git
synced 2026-10-24 02:12:33 +00:00
feat: use adaptive colors to accommodate different terminal bg colors
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
|
||||
"github.com/illusionman1212/gorc/cmds"
|
||||
"github.com/illusionman1212/gorc/ui"
|
||||
)
|
||||
|
||||
type InputState struct {
|
||||
@@ -64,12 +65,12 @@ func (s InputState) Update(msg tea.Msg) (InputState, tea.Cmd) {
|
||||
|
||||
func (s *InputState) Focus() {
|
||||
s.Input.Focus()
|
||||
s.Style = s.Style.Copy().BorderForeground(lipgloss.Color("105"))
|
||||
s.Style = s.Style.Copy().BorderForeground(ui.AccentColor)
|
||||
}
|
||||
|
||||
func (s *InputState) Blur() {
|
||||
s.Input.Blur()
|
||||
s.Style = s.Style.Copy().BorderForeground(lipgloss.Color("#EEE"))
|
||||
s.Style = s.Style.Copy().BorderForeground(ui.PrimaryColor)
|
||||
}
|
||||
|
||||
func (s *InputState) SetSize(width int) {
|
||||
|
||||
+14
-14
@@ -196,24 +196,24 @@ func (s State) Update(msg tea.Msg) (State, tea.Cmd) {
|
||||
}
|
||||
|
||||
func (s *State) Focus() {
|
||||
s.Viewport.Style = s.Viewport.Style.Copy().BorderForeground(lipgloss.Color("105"))
|
||||
s.Viewport.Style = s.Viewport.Style.Copy().BorderForeground(ui.AccentColor)
|
||||
|
||||
tab = tab.Copy().BorderForeground(lipgloss.Color("105"))
|
||||
leftArrowDim = leftArrowDim.Copy().BorderForeground(lipgloss.Color("105"))
|
||||
rightArrowDim = rightArrowDim.Copy().BorderForeground(lipgloss.Color("105"))
|
||||
leftArrowLit = leftArrowLit.Copy().BorderForeground(lipgloss.Color("105"))
|
||||
rightArrowLit = rightArrowLit.Copy().BorderForeground(lipgloss.Color("105"))
|
||||
tabLine = tabLine.Copy().Foreground(lipgloss.Color("105"))
|
||||
tab = tab.Copy().BorderForeground(ui.AccentColor)
|
||||
leftArrowDim = leftArrowDim.Copy().BorderForeground(ui.AccentColor)
|
||||
rightArrowDim = rightArrowDim.Copy().BorderForeground(ui.AccentColor)
|
||||
leftArrowLit = leftArrowLit.Copy().BorderForeground(ui.AccentColor)
|
||||
rightArrowLit = rightArrowLit.Copy().BorderForeground(ui.AccentColor)
|
||||
tabLine = tabLine.Copy().Foreground(ui.AccentColor)
|
||||
}
|
||||
func (s *State) Blur() {
|
||||
s.Viewport.Style = s.Viewport.Style.Copy().BorderForeground(lipgloss.Color("#EEE"))
|
||||
s.Viewport.Style = s.Viewport.Style.Copy().BorderForeground(ui.PrimaryColor)
|
||||
|
||||
tab = tab.Copy().UnsetBorderForeground()
|
||||
leftArrowDim = leftArrowDim.Copy().UnsetBorderForeground()
|
||||
rightArrowDim = rightArrowDim.Copy().UnsetBorderForeground()
|
||||
leftArrowLit = leftArrowLit.Copy().UnsetBorderForeground()
|
||||
rightArrowLit = rightArrowLit.Copy().UnsetBorderForeground()
|
||||
tabLine = tabLine.Copy().UnsetForeground()
|
||||
tab = tab.Copy().BorderForeground(ui.PrimaryColor)
|
||||
leftArrowDim = leftArrowDim.Copy().BorderForeground(ui.PrimaryColor)
|
||||
rightArrowDim = rightArrowDim.Copy().BorderForeground(ui.PrimaryColor)
|
||||
leftArrowLit = leftArrowLit.Copy().BorderForeground(ui.PrimaryColor)
|
||||
rightArrowLit = rightArrowLit.Copy().BorderForeground(ui.PrimaryColor)
|
||||
tabLine = tabLine.Copy().Foreground(ui.PrimaryColor)
|
||||
}
|
||||
|
||||
func (s *State) SetSize(width, height int) {
|
||||
|
||||
@@ -23,9 +23,9 @@ import (
|
||||
|
||||
"github.com/charmbracelet/bubbles/viewport"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/illusionman1212/gorc/cmds"
|
||||
"github.com/illusionman1212/gorc/irc"
|
||||
"github.com/illusionman1212/gorc/ui"
|
||||
)
|
||||
|
||||
type SidePanelState struct {
|
||||
@@ -101,12 +101,12 @@ func (s SidePanelState) Update(msg tea.Msg) (SidePanelState, tea.Cmd) {
|
||||
|
||||
func (s *SidePanelState) Focus() {
|
||||
s.Focused = true
|
||||
s.Viewport.Style = s.Viewport.Style.BorderForeground(lipgloss.Color("105"))
|
||||
s.Viewport.Style = s.Viewport.Style.BorderForeground(ui.AccentColor)
|
||||
}
|
||||
|
||||
func (s *SidePanelState) Blur() {
|
||||
s.Focused = false
|
||||
s.Viewport.Style = s.Viewport.Style.BorderForeground(lipgloss.Color("#EEE"))
|
||||
s.Viewport.Style = s.Viewport.Style.BorderForeground(ui.PrimaryColor)
|
||||
}
|
||||
|
||||
func (s *SidePanelState) UpdateNicks() {
|
||||
|
||||
+15
-11
@@ -26,15 +26,15 @@ var (
|
||||
Border(lipgloss.NormalBorder(), true).
|
||||
Padding(0, 1).
|
||||
Width(ui.MainStyle.GetWidth()).
|
||||
BorderForeground(lipgloss.Color("105"))
|
||||
BorderForeground(ui.AccentColor)
|
||||
MessagesStyle = lipgloss.NewStyle().
|
||||
Border(lipgloss.NormalBorder(), false, true, true, true).
|
||||
Width(ui.MainStyle.GetWidth() * 8 / 10).
|
||||
BorderForeground(lipgloss.Color("#EEE"))
|
||||
BorderForeground(ui.PrimaryColor)
|
||||
SidePanelStyle = lipgloss.NewStyle().
|
||||
Border(lipgloss.NormalBorder(), true).
|
||||
Width(ui.MainStyle.GetWidth() * 2 / 10).
|
||||
BorderForeground(lipgloss.Color("#EEE"))
|
||||
BorderForeground(ui.PrimaryColor)
|
||||
|
||||
activeTabBorder = lipgloss.Border{
|
||||
Top: "─",
|
||||
@@ -46,7 +46,7 @@ var (
|
||||
BottomLeft: "┘",
|
||||
BottomRight: "└",
|
||||
}
|
||||
highlight = lipgloss.AdaptiveColor{Light: "#874BFD", Dark: "105"}
|
||||
|
||||
tabBorder = lipgloss.Border{
|
||||
Top: "─",
|
||||
Bottom: "─",
|
||||
@@ -82,28 +82,32 @@ var (
|
||||
|
||||
tab = lipgloss.NewStyle().
|
||||
Border(tabBorder, true).
|
||||
Foreground(ui.PrimaryColor).
|
||||
Padding(0, 1)
|
||||
|
||||
activeTab = tab.Copy().
|
||||
Border(activeTabBorder, true).
|
||||
BorderForeground(highlight).
|
||||
Foreground(lipgloss.Color("105")).
|
||||
BorderForeground(ui.AccentColor).
|
||||
Foreground(ui.AccentColor).
|
||||
Italic(true).
|
||||
Bold(true)
|
||||
|
||||
leftArrowDim = tab.Copy().
|
||||
Border(leftArrowBorder, true).
|
||||
Foreground(lipgloss.Color("#444"))
|
||||
BorderForeground(ui.PrimaryColor).
|
||||
Foreground(ui.ArrowsDimColor)
|
||||
rightArrowDim = tab.Copy().
|
||||
Border(rightArrowBorder, true).
|
||||
Foreground(lipgloss.Color("#444"))
|
||||
BorderForeground(ui.PrimaryColor).
|
||||
Foreground(ui.ArrowsDimColor)
|
||||
|
||||
leftArrowLit = tab.Copy().
|
||||
Border(leftArrowBorder, true).
|
||||
Foreground(lipgloss.Color("#FFF"))
|
||||
Foreground(ui.PrimaryColor)
|
||||
rightArrowLit = tab.Copy().
|
||||
Border(rightArrowBorder, true).
|
||||
Foreground(lipgloss.Color("#FFF"))
|
||||
Foreground(ui.PrimaryColor)
|
||||
|
||||
tabLine = lipgloss.NewStyle()
|
||||
tabLine = lipgloss.NewStyle().
|
||||
Foreground(ui.PrimaryColor)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user