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

Implement arbitrary theme variables #3069

Merged
merged 1 commit into from
Mar 12, 2024
Merged

Conversation

MinusGix
Copy link
Member

@MinusGix MinusGix commented Mar 12, 2024

  • Added an entry to CHANGELOG.md if this change could be valuable to users

This PR implements (sortof reimplements) a feature I've wanted for a while as it makes themes significantly easier to write & customize.
Rather than having base colors, we have general purpose variables that themes provide. These are prefixed with $.
I've also modified the default themes to have a few extra variables for common patterns in them.

  • Makes it simpler to write themes, letting you have one variable you tweak to get the color right rather than copy & pasting it a half dozen times.
  • Allows easier user customization of themes if all they have to change to shift the general feel of a theme to be lighter/darker/bluer/redder is a few variables rather than every location that uses the color
  • Makes so if a theme defines $secondary-background and then we add a new view that uses $secondary-background, it will still be consistent with the theme. (because it falls back to default color = "$secondary-background" which is checked against the current theme first)

Possible future improvements:

  • Don't sort the colors in the theme changing view
  • Theme-specific alterations, to make it easy to have a basic alteration to a theme while still using it & receiving any updates
  • Functions? alpha($primary-background, 0x60) and similar would allow variables to work even better, but do add some parsing complexity.

@MinusGix MinusGix added A-ui Area: UI rendering and interactions A-plugins Area: plugin system labels Mar 12, 2024
@MinusGix MinusGix closed this Mar 12, 2024
@MinusGix MinusGix reopened this Mar 12, 2024
@MinusGix MinusGix marked this pull request as ready for review March 12, 2024 18:55
Copy link

codecov bot commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 0% with 55 lines in your changes are missing coverage. Please review.

Project coverage is 5.95%. Comparing base (43b54d0) to head (a721ff2).
Report is 37 commits behind head on master.

Files Patch % Lines
lapce-app/src/config/color_theme.rs 0.00% 51 Missing ⚠️
lapce-app/src/settings.rs 0.00% 3 Missing ⚠️
lapce-app/src/config.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #3069      +/-   ##
=========================================
- Coverage    6.01%   5.95%   -0.06%     
=========================================
  Files         122     122              
  Lines       42703   43182     +479     
=========================================
+ Hits         2569    2572       +3     
- Misses      40134   40610     +476     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dzhou121 dzhou121 merged commit 750b122 into lapce:master Mar 12, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-plugins Area: plugin system A-ui Area: UI rendering and interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants