Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CSS variables for font-family definition #11045

Closed
silverwind opened this issue Apr 11, 2020 · 0 comments · Fixed by #13204
Closed

Use CSS variables for font-family definition #11045

silverwind opened this issue Apr 11, 2020 · 0 comments · Fixed by #13204
Labels
topic/ui Change the appearance of the Gitea UI type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@silverwind
Copy link
Member

Fonts are currently set by Less variables which cannot be overridden at runtime. I'd propose a method that makes this possible so users can do this both via a custom .css file or even using a userstyle in their browser if they so desire. In our code we would have something like:

:root {
  --fonts-proportional: -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto;
  --fonts-monospace: 'SF Mono', Consolas, Menlo, 'Liberation Mono', Monaco, 'Lucida Console';
  --fonts-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

body {
  font-family: var(--fonts-proportional) var(--fonts-emoji);
}

pre, code {
  font-family: var(--fonts-monospace);
}

A user can then override via:

@font-face {
  font-family: 'Lato';
}

:root {
  --fonts-proportional: Lato;
}

Depends on: #6147

@guillep2k guillep2k added type/proposal The new feature has not been accepted yet but needs to be discussed first. topic/ui Change the appearance of the Gitea UI labels Apr 11, 2020
silverwind added a commit to silverwind/gitea that referenced this issue Oct 18, 2020
- Use CSS variables for fonts, making the fonts easier to customize
- Remove postcss-loader, it's not doing anything useful and is actually
  applying strange transforms on our CSS.

Fixes: go-gitea#11045
techknowlogick pushed a commit that referenced this issue Oct 19, 2020
* Use CSS Variables for fonts, remove postcss-loader

- Use CSS variables for fonts, making the fonts easier to customize
- Remove postcss-loader, it's not doing anything useful and is actually
  applying strange transforms on our CSS.

Fixes: #11045

* introduce helper variable, mark documented vars

* work around case issue by always quoting specific fonts
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui Change the appearance of the Gitea UI type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants