mirror of
https://github.com/mrusme/neonmodem.git
synced 2025-02-02 15:07:59 -05:00
Added Selector to Theme, fixed formatting
This commit is contained in:
parent
32b1ffe1f0
commit
04eec8293a
@ -47,6 +47,10 @@ type Config struct {
|
|||||||
Systems []SystemConfig
|
Systems []SystemConfig
|
||||||
|
|
||||||
Theme struct {
|
Theme struct {
|
||||||
|
Header struct {
|
||||||
|
Selector ThemeItemConfig
|
||||||
|
}
|
||||||
|
|
||||||
DialogBox struct {
|
DialogBox struct {
|
||||||
Window struct {
|
Window struct {
|
||||||
Focused ThemeItemConfig
|
Focused ThemeItemConfig
|
||||||
@ -186,6 +190,22 @@ func SetDefaults(cacheDir string) {
|
|||||||
|
|
||||||
viper.SetDefault("RenderImages", "true")
|
viper.SetDefault("RenderImages", "true")
|
||||||
|
|
||||||
|
// --- Header ---
|
||||||
|
// Header Selector
|
||||||
|
viper.SetDefault("Theme.Header.Selector.Margin",
|
||||||
|
[]int{0, 0, 0, 0})
|
||||||
|
viper.SetDefault("Theme.Header.Selector.Padding",
|
||||||
|
[]int{0, 1, 0, 1})
|
||||||
|
viper.SetDefault("Theme.Header.Selector.Border.Border",
|
||||||
|
lipgloss.NormalBorder())
|
||||||
|
viper.SetDefault("Theme.Header.Selector.Border.Sides",
|
||||||
|
[]bool{true, true, true, true},
|
||||||
|
)
|
||||||
|
viper.SetDefault("Theme.Header.Selector.Border.Foreground",
|
||||||
|
lipgloss.AdaptiveColor{Light: "#6ca1d0", Dark: "#6ca1d0"})
|
||||||
|
viper.SetDefault("Theme.Header.Selector.Foreground",
|
||||||
|
lipgloss.AdaptiveColor{Light: "#6ca1d0", Dark: "#6ca1d0"})
|
||||||
|
|
||||||
// --- DialogBox ---
|
// --- DialogBox ---
|
||||||
// DialogBox Window:Focused
|
// DialogBox Window:Focused
|
||||||
viper.SetDefault("Theme.DialogBox.Window.Focused.Margin",
|
viper.SetDefault("Theme.DialogBox.Window.Focused.Margin",
|
||||||
@ -198,7 +218,7 @@ func SetDefaults(cacheDir string) {
|
|||||||
[]bool{false, true, true, true},
|
[]bool{false, true, true, true},
|
||||||
)
|
)
|
||||||
viper.SetDefault("Theme.DialogBox.Window.Focused.Border.Foreground",
|
viper.SetDefault("Theme.DialogBox.Window.Focused.Border.Foreground",
|
||||||
lipgloss.AdaptiveColor{Light: "#00ffff", Dark: "#00ffff"})
|
lipgloss.AdaptiveColor{Light: "#82e4dc", Dark: "#82e4dc"})
|
||||||
|
|
||||||
// DialogBox Window:Blurred
|
// DialogBox Window:Blurred
|
||||||
viper.SetDefault("Theme.DialogBox.Window.Blurred.Margin",
|
viper.SetDefault("Theme.DialogBox.Window.Blurred.Margin",
|
||||||
@ -221,7 +241,7 @@ func SetDefaults(cacheDir string) {
|
|||||||
viper.SetDefault("Theme.DialogBox.Titlebar.Focused.Foreground",
|
viper.SetDefault("Theme.DialogBox.Titlebar.Focused.Foreground",
|
||||||
lipgloss.AdaptiveColor{Light: "#ffffff", Dark: "#000000"})
|
lipgloss.AdaptiveColor{Light: "#ffffff", Dark: "#000000"})
|
||||||
viper.SetDefault("Theme.DialogBox.Titlebar.Focused.Background",
|
viper.SetDefault("Theme.DialogBox.Titlebar.Focused.Background",
|
||||||
lipgloss.AdaptiveColor{Light: "#00cccc", Dark: "#00cccc"})
|
lipgloss.AdaptiveColor{Light: "#82e4dc", Dark: "#82e4dc"})
|
||||||
|
|
||||||
// DialogBox Titlebar:Blurred
|
// DialogBox Titlebar:Blurred
|
||||||
viper.SetDefault("Theme.DialogBox.Titlebar.Blurred.Margin",
|
viper.SetDefault("Theme.DialogBox.Titlebar.Blurred.Margin",
|
||||||
@ -308,7 +328,7 @@ func SetDefaults(cacheDir string) {
|
|||||||
[]bool{true, true, true, true},
|
[]bool{true, true, true, true},
|
||||||
)
|
)
|
||||||
viper.SetDefault("Theme.PostsList.List.Focused.Border.Foreground",
|
viper.SetDefault("Theme.PostsList.List.Focused.Border.Foreground",
|
||||||
lipgloss.AdaptiveColor{Light: "#00ffff", Dark: "#00ffff"})
|
lipgloss.AdaptiveColor{Light: "#82e4dc", Dark: "#82e4dc"})
|
||||||
|
|
||||||
// PostsList List:Blurred
|
// PostsList List:Blurred
|
||||||
viper.SetDefault("Theme.PostsList.List.Blurred.Margin",
|
viper.SetDefault("Theme.PostsList.List.Blurred.Margin",
|
||||||
@ -346,7 +366,7 @@ func SetDefaults(cacheDir string) {
|
|||||||
viper.SetDefault("Theme.PostsList.Item.Selected.Border.Foreground",
|
viper.SetDefault("Theme.PostsList.Item.Selected.Border.Foreground",
|
||||||
lipgloss.AdaptiveColor{Light: "#ffd500", Dark: "#ffd500"})
|
lipgloss.AdaptiveColor{Light: "#ffd500", Dark: "#ffd500"})
|
||||||
viper.SetDefault("Theme.PostsList.Item.Selected.Foreground",
|
viper.SetDefault("Theme.PostsList.Item.Selected.Foreground",
|
||||||
lipgloss.AdaptiveColor{Light: "#F25D94", Dark: "#F25D94"})
|
lipgloss.AdaptiveColor{Light: "#f119a0", Dark: "#f119a0"})
|
||||||
|
|
||||||
// PostsList ItemDetail:Focused
|
// PostsList ItemDetail:Focused
|
||||||
viper.SetDefault("Theme.PostsList.ItemDetail.Focused.Padding",
|
viper.SetDefault("Theme.PostsList.ItemDetail.Focused.Padding",
|
||||||
@ -385,7 +405,7 @@ func SetDefaults(cacheDir string) {
|
|||||||
[]bool{true, true, true, true},
|
[]bool{true, true, true, true},
|
||||||
)
|
)
|
||||||
viper.SetDefault("Theme.PopupList.List.Focused.Border.Foreground",
|
viper.SetDefault("Theme.PopupList.List.Focused.Border.Foreground",
|
||||||
lipgloss.AdaptiveColor{Light: "#00ffff", Dark: "#00ffff"})
|
lipgloss.AdaptiveColor{Light: "#82e4dc", Dark: "#82e4dc"})
|
||||||
|
|
||||||
// PopupList List:Blurred
|
// PopupList List:Blurred
|
||||||
viper.SetDefault("Theme.PopupList.List.Blurred.Margin",
|
viper.SetDefault("Theme.PopupList.List.Blurred.Margin",
|
||||||
@ -423,7 +443,7 @@ func SetDefaults(cacheDir string) {
|
|||||||
viper.SetDefault("Theme.PopupList.Item.Selected.Border.Foreground",
|
viper.SetDefault("Theme.PopupList.Item.Selected.Border.Foreground",
|
||||||
lipgloss.AdaptiveColor{Light: "#ffd500", Dark: "#ffd500"})
|
lipgloss.AdaptiveColor{Light: "#ffd500", Dark: "#ffd500"})
|
||||||
viper.SetDefault("Theme.PopupList.Item.Selected.Foreground",
|
viper.SetDefault("Theme.PopupList.Item.Selected.Foreground",
|
||||||
lipgloss.AdaptiveColor{Light: "#F25D94", Dark: "#F25D94"})
|
lipgloss.AdaptiveColor{Light: "#f119a0", Dark: "#f119a0"})
|
||||||
|
|
||||||
// PopupList ItemDetail:Focused
|
// PopupList ItemDetail:Focused
|
||||||
viper.SetDefault("Theme.PopupList.ItemDetail.Focused.Padding",
|
viper.SetDefault("Theme.PopupList.ItemDetail.Focused.Padding",
|
||||||
@ -455,7 +475,7 @@ func SetDefaults(cacheDir string) {
|
|||||||
viper.SetDefault("Theme.Post.Author.Padding",
|
viper.SetDefault("Theme.Post.Author.Padding",
|
||||||
[]int{0, 1, 0, 1})
|
[]int{0, 1, 0, 1})
|
||||||
viper.SetDefault("Theme.Post.Author.Foreground",
|
viper.SetDefault("Theme.Post.Author.Foreground",
|
||||||
lipgloss.AdaptiveColor{Light: "#F25D94", Dark: "#F25D94"})
|
lipgloss.AdaptiveColor{Light: "#f119a0", Dark: "#f119a0"})
|
||||||
|
|
||||||
// Post Subject
|
// Post Subject
|
||||||
viper.SetDefault("Theme.Post.Subject.Padding",
|
viper.SetDefault("Theme.Post.Subject.Padding",
|
||||||
@ -463,7 +483,7 @@ func SetDefaults(cacheDir string) {
|
|||||||
viper.SetDefault("Theme.Post.Subject.Foreground",
|
viper.SetDefault("Theme.Post.Subject.Foreground",
|
||||||
lipgloss.AdaptiveColor{Light: "#FFFFFF", Dark: "#FFFFFF"})
|
lipgloss.AdaptiveColor{Light: "#FFFFFF", Dark: "#FFFFFF"})
|
||||||
viper.SetDefault("Theme.Post.Subject.Background",
|
viper.SetDefault("Theme.Post.Subject.Background",
|
||||||
lipgloss.AdaptiveColor{Light: "#F25D94", Dark: "#F25D94"})
|
lipgloss.AdaptiveColor{Light: "#f119a0", Dark: "#f119a0"})
|
||||||
|
|
||||||
// Reply Author
|
// Reply Author
|
||||||
viper.SetDefault("Theme.Reply.Author.Padding",
|
viper.SetDefault("Theme.Reply.Author.Padding",
|
||||||
|
@ -67,12 +67,6 @@ func (m Model) View() string {
|
|||||||
|
|
||||||
selectorWidth := 40
|
selectorWidth := 40
|
||||||
selectorTextLen := selectorWidth - 7
|
selectorTextLen := selectorWidth - 7
|
||||||
selector := lipgloss.NewStyle().
|
|
||||||
Foreground(lipgloss.Color("#7fffd4")).
|
|
||||||
BorderForeground(lipgloss.Color("#7fffd4")).
|
|
||||||
Border(lipgloss.NormalBorder()).
|
|
||||||
Padding(0, 1, 0, 1).
|
|
||||||
Width(selectorWidth)
|
|
||||||
|
|
||||||
curSysIdx := m.ctx.GetCurrentSystem()
|
curSysIdx := m.ctx.GetCurrentSystem()
|
||||||
var currentSystem string = "All"
|
var currentSystem string = "All"
|
||||||
@ -92,15 +86,21 @@ func (m Model) View() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
systemSelector := selector.Render(fmt.Sprintf("⏷ %s", currentSystem))
|
systemSelector := m.ctx.Theme.Header.Selector.
|
||||||
forumSelector := selector.Render(fmt.Sprintf("⏷ %s", currentForum))
|
Width(selectorWidth).Render(fmt.Sprintf("⏷ %s", currentSystem))
|
||||||
|
forumSelector := m.ctx.Theme.Header.Selector.
|
||||||
|
Width(selectorWidth).Render(fmt.Sprintf("⏷ %s", currentForum))
|
||||||
|
|
||||||
selectorColumn := lipgloss.JoinVertical(lipgloss.Center,
|
selectorColumn := lipgloss.JoinVertical(lipgloss.Center,
|
||||||
lipgloss.JoinHorizontal(lipgloss.Bottom, "System: \n "+
|
lipgloss.JoinHorizontal(lipgloss.Bottom, "System: \n "+
|
||||||
lipgloss.NewStyle().Foreground(m.ctx.Theme.DialogBox.Bottombar.GetForeground()).Render("C-e"),
|
lipgloss.NewStyle().Foreground(
|
||||||
|
m.ctx.Theme.DialogBox.Bottombar.GetForeground(),
|
||||||
|
).Render("C-e"),
|
||||||
systemSelector),
|
systemSelector),
|
||||||
lipgloss.JoinHorizontal(lipgloss.Bottom, "Forum: \n "+
|
lipgloss.JoinHorizontal(lipgloss.Bottom, "Forum: \n "+
|
||||||
lipgloss.NewStyle().Foreground(m.ctx.Theme.DialogBox.Bottombar.GetForeground()).Render("C-t"),
|
lipgloss.NewStyle().Foreground(
|
||||||
|
m.ctx.Theme.DialogBox.Bottombar.GetForeground(),
|
||||||
|
).Render("C-t"),
|
||||||
forumSelector),
|
forumSelector),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -108,7 +108,13 @@ func (m Model) View() string {
|
|||||||
spinner = m.spinner.View()
|
spinner = m.spinner.View()
|
||||||
}
|
}
|
||||||
|
|
||||||
row = lipgloss.JoinHorizontal(lipgloss.Top, banner, " ", selectorColumn, " ", spinner)
|
row = lipgloss.JoinHorizontal(lipgloss.Top,
|
||||||
|
banner,
|
||||||
|
" ",
|
||||||
|
selectorColumn,
|
||||||
|
" ",
|
||||||
|
spinner,
|
||||||
|
)
|
||||||
|
|
||||||
return row
|
return row
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Theme struct {
|
type Theme struct {
|
||||||
|
Header struct {
|
||||||
|
Selector lipgloss.Style
|
||||||
|
}
|
||||||
|
|
||||||
DialogBox struct {
|
DialogBox struct {
|
||||||
Window struct {
|
Window struct {
|
||||||
Focused lipgloss.Style
|
Focused lipgloss.Style
|
||||||
@ -77,6 +81,9 @@ type Theme struct {
|
|||||||
func New(cfg *config.Config) *Theme {
|
func New(cfg *config.Config) *Theme {
|
||||||
t := new(Theme)
|
t := new(Theme)
|
||||||
|
|
||||||
|
t.Header.Selector =
|
||||||
|
t.fromConfig(&cfg.Theme.Header.Selector)
|
||||||
|
|
||||||
t.DialogBox.Window.Focused =
|
t.DialogBox.Window.Focused =
|
||||||
t.fromConfig(&cfg.Theme.DialogBox.Window.Focused)
|
t.fromConfig(&cfg.Theme.DialogBox.Window.Focused)
|
||||||
t.DialogBox.Window.Blurred =
|
t.DialogBox.Window.Blurred =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user