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

chore: clean up theming #454

Merged
merged 1 commit into from
Jul 5, 2023
Merged

Conversation

SethFalco
Copy link
Member

@SethFalco SethFalco commented Jul 4, 2023

When I contributed before, and while reviewing the project now, dealing with the CSS has been very painful due to how theming is handled.

The way most projects handle theming, is using CSS variables on :root which can then be used throughout the site. Then overriding those variables either on a media query or a class.

Here are examples from the Exercism and Microsoft websites, respectively:

This offers a few benefits:

  1. Cleaner and less CSS. Avoids overriding hell!
  2. Semantic class/style names. Rather than having .white which, gets overridden to black in dark mode.
  3. Consistent style. We won't accidentally have 5 different shades of a single color across the site.
  4. Easier to determine what color/style to use for future components.
  5. Easy to develop new themes. Just define a new class selector that overrides the vars.

This should avoid problems like this in future:

The goal is to leave the site the same (or better), but reduce CSS and make theming easier to maintain.


I've made some subtle changes, intentionally:

  1. Use the same shade of blue for the navbar, buttons, and top-footer.
  2. Make the inactive button (text/file) use white/black text instead of blue. The accent color shouldn't be used for text, imo.
  3. Use a darker color for the inactive button, so it's more separable from the background.
  4. Not sure why, but the dark theme had padding above the translation textareas before. I removed that to be consistent with the light theme.

Screenshots

Light Mode After (Left) and Before (Right)

image

Dark Mode After (Left) and Before (Right)

image


PS: I hope to polish the UI and improve accessibility soon, but before that, I'm doing chores to make the project easier to maintain.

@pierotofy
Copy link
Member

This is great @SethFalco 👍 thanks for the contribution!

@pierotofy pierotofy merged commit abc7700 into LibreTranslate:main Jul 5, 2023
4 checks passed
@SethFalco SethFalco deleted the theming branch May 14, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants