mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-18 15:37:48 +00:00
feat(ui): improve markup attention colors (#13224)
## Refactor styles of attention markdown formatting * simplify CSS * simplify generated HTML a bit * get rid of a few `!important` properties by using higher specificity selectors * bring everything to one file and out of `base.css` * apply declarative purpose-built colors introduced in forgejo/forgejo!9643 * create new colors for `violet` and `blue` * move `oklch` declarations out of themes to `base.css`, leave themes with access to all parameters * use declarative styles in all themes, not just `forgejo-dark`, remove variable fallbacks from styles * remove rule overrides from `forgejo-dark`. _it should ideally only contain variables, not rules_ What's improved: * lightness and saturation are now same for all color variants of different attention types within one theme * code is more maintainable * custom themes are easier to make, our example themes are dumping less RGB values at theme authors and allow changing some important colors just by tweaking numeric values (lightness, chroma, hue) * forgejo and gitea dark themes are now using good contrast ### Preview #### Forgejo themes |dark before|dark after|light before|light after| |-|-|-|-| ||||| #### Gitea themes |dark before|dark after|light before|light after| |-|-|-|-| ||||| Some previously (or now) unused color variables were also removed. They have existed for years and were never applied anywhere. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13224 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
parent
29a27d1b0a
commit
1d72ad088c
17 changed files with 154 additions and 117 deletions
|
|
@ -125,7 +125,7 @@ func (r *GitHubCalloutHTMLRenderer) renderAttention(w util.BufWriter, source []b
|
|||
default:
|
||||
octiconName = "info"
|
||||
}
|
||||
_, _ = w.WriteString(string(svg.RenderHTML("octicon-"+octiconName, 16, "attention-icon attention-"+n.AttentionType)))
|
||||
_, _ = w.WriteString(string(svg.RenderHTML("octicon-"+octiconName, 16)))
|
||||
}
|
||||
return ast.WalkContinue, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ func createDefaultPolicy() *bluemonday.Policy {
|
|||
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-title$`)).OnElements("p")
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-header attention-\w+$`)).OnElements("blockquote")
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-\w+$`)).OnElements("strong")
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^attention-icon attention-\w+ svg octicon-[\w-]+$`)).OnElements("svg")
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^svg octicon-[\w-]+$`)).OnElements("svg")
|
||||
policy.AllowAttrs("viewBox", "width", "height", "aria-hidden").OnElements("svg")
|
||||
policy.AllowAttrs("fill-rule", "d").OnElements("path")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue