aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/theme.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web/theme.go')
-rw-r--r--internal/web/theme.go25
1 files changed, 17 insertions, 8 deletions
diff --git a/internal/web/theme.go b/internal/web/theme.go
index 9eae856..031f8fd 100644
--- a/internal/web/theme.go
+++ b/internal/web/theme.go
@@ -42,7 +42,7 @@ type Theme struct {
TitleSize string `json:"title_size"` // normal | small | large (the site title in the header)
HeaderRule string `json:"header_rule"` // none | line | dots | stripes, drawn beside the title/logo modules in the header
- NavAlign string `json:"nav_align"` // left | center | right (header menu)
+ NavAlign string `json:"nav_align"` // left | center | right | spread (header menu)
// The link styles are switches that combine; blog.css draws them from
// the body classes NavClass makes. NavStyle is the select they replaced
// (normal | uppercase | plain): still decoded from themes saved before,
@@ -51,6 +51,9 @@ type Theme struct {
NavBold bool `json:"nav_bold"`
NavUpper bool `json:"nav_upper"` // uppercase, letter-spaced
NavUnderline string `json:"nav_underline"` // hover | never | always
+ NavSize string `json:"nav_size"` // normal | small | large
+ NavGap string `json:"nav_gap"` // normal | tight | wide (space around each link)
+ NavActive string `json:"nav_active"` // underline | bold | box | none: how the current page's link is marked
NavBg string `json:"nav_bg"`
NavText string `json:"nav_text"`
NavHover string `json:"nav_hover"` // "" = same as NavText
@@ -115,7 +118,7 @@ func DefaultTheme() Theme {
ContentStyle: "card", ContentPadding: "normal",
Font: "sans", HeadingFont: "same", FontSize: "normal",
HeaderImageHeight: "medium", HeaderAlign: "left", HeaderBg: "#2f3a4a", HeaderText: "#ffffff", TitleSize: "normal", HeaderRule: "none",
- NavAlign: "left", NavBold: true, NavUnderline: "hover", NavBg: "#ffffff", NavText: "#222222",
+ NavAlign: "left", NavBold: true, NavUnderline: "hover", NavSize: "normal", NavGap: "normal", NavActive: "underline", NavBg: "#ffffff", NavText: "#222222",
ShowDates: true, DateFormat: "long", PostsPerPage: postsPerPageChoices[0], ListStyle: "full", PostImage: "top", TitleRule: "none", PostNotices: true,
FooterBg: "#2f3a4a", FooterColor: "#d0d5dc", FooterAlign: "center",
LogoSize: "medium",
@@ -133,7 +136,7 @@ func ParseTheme(raw json.RawMessage) Theme {
// it stood for, and is dropped from the JSON on the next save.
switch t.NavStyle {
case "uppercase":
- t.NavUpper = true
+ t.NavUpper, t.NavSize = true, "small" // the smaller size was part of that look
case "plain":
t.NavBold, t.NavUnderline = false, "always"
}
@@ -205,8 +208,11 @@ func (t *Theme) normalize() {
t.HeaderText = color(t.HeaderText, d.HeaderText)
t.TitleSize = pick(t.TitleSize, "normal", "small", "large")
t.HeaderRule = pick(t.HeaderRule, "none", "line", "dots", "stripes")
- t.NavAlign = pick(t.NavAlign, "left", "center", "right")
+ t.NavAlign = pick(t.NavAlign, "left", "center", "right", "spread")
t.NavUnderline = pick(t.NavUnderline, "hover", "never", "always")
+ t.NavSize = pick(t.NavSize, "normal", "small", "large")
+ t.NavGap = pick(t.NavGap, "normal", "tight", "wide")
+ t.NavActive = pick(t.NavActive, "underline", "bold", "box", "none")
t.NavBg = color(t.NavBg, d.NavBg)
t.NavText = color(t.NavText, d.NavText)
t.NavHover = optColor(t.NavHover)
@@ -278,6 +284,9 @@ func ThemeFromForm(cur Theme, f url.Values) Theme {
t.NavBold = on("nav_bold")
t.NavUpper = on("nav_upper")
t.NavUnderline = get("nav_underline")
+ t.NavSize = get("nav_size")
+ t.NavGap = get("nav_gap")
+ t.NavActive = get("nav_active")
t.NavBg = get("nav_bg")
t.NavText = get("nav_text")
t.NavHover = hover("nav_hover")
@@ -522,10 +531,11 @@ func (t Theme) RuleClass() string {
return "ruled rule-" + t.HeaderRule
}
-// NavClass is the body classes blog.css draws the menu links from (weight,
-// case, underline); the theme CSS only colours them.
+// NavClass is the body classes blog.css draws the menu links from (alignment,
+// underline, size, spacing, the current page's mark, weight, case); the theme
+// CSS only colours them.
func (t Theme) NavClass() string {
- c := []string{"nav-ul-" + t.NavUnderline}
+ c := []string{"nav-" + t.NavAlign, "nav-ul-" + t.NavUnderline, "nav-size-" + t.NavSize, "nav-gap-" + t.NavGap, "nav-active-" + t.NavActive}
if t.NavBold {
c = append(c, "nav-bold")
}
@@ -581,7 +591,6 @@ a:hover {{"{"}}{{if .LinkHover}} color:{{.LinkHover}};{{end}}{{if eq .LinkUnderl
.site-header a { color:{{.HeaderText}}; }
.header-image img { max-height:{{.HeaderImageMaxHeight}}; }
.site-nav { background:{{.NavBg}}; }
-.nav-inner { text-align:{{.NavAlign}}; }
.site-nav a { color:{{.NavText}}; }
{{- if .NavHover}}
.site-nav a:hover { color:{{.NavHover}}; }