You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🎨 define theme colors in a single source file - #9508
This is a first step in trying to clean up and standardise some tokens and reduce the amount of work that custom theme authors have to do to keep up with our changes, but also to initially create themes. The idea is the fewer tokens the better, and the more cohesive the app will look as a result.
This PR changes how the themes work, instead of defining each token for each theme in their own files, let's just do it in one place and use ts to get good typechecking on the whole lot. Stops us from running into issues like #9498 where one theme was missing some tokens.
Related issue(s)
Testing
VRT should not change
Checklist
Release notes added (see link above)
No obvious regressions in affected areas
Self-review has been performed - I have read every line of this diff and can explain what each change does and why it is needed
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Reviewing files that changed from the base of the PR and between fecbca2 and 1c1f84f.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Theme colors now come from a TypeScript token map. The package generates palette and light, dark, and midnight theme CSS from those tokens. The component library and desktop client import the generated CSS through named exports.
Theme names, token types, palette values, and shared or theme-specific color definitions are added.
Generate CSS and theme variables packages/component-library/src/themes/source/generate.ts, packages/component-library/src/theme.ts, packages/component-library/src/themes/source/generate.web.test.ts, packages/component-library/src/theme.web.test.ts
Generation helpers validate token references and create palette and theme CSS. The theme map derives its CSS-variable references from the token definitions. Tests cover generated values, token coverage, fallbacks, and invalid references; the previous CSS comparison test is removed.
The themes module exports generated CSS. The package export map and consumers use named exports, and the separate palette and theme CSS files are removed. A maintenance release note describes the token source change.
sequenceDiagram
participant colors as colors.ts
participant generate as generate.ts
participant themes as themes/index.ts
participant preview as Storybook preview.tsx
participant desktop as desktop theme.tsx
colors->>themes: Provide color definitions
themes->>generate: Generate palette and theme CSS
generate-->>themes: Return generated CSS
themes-->>preview: Export named CSS values
themes-->>desktop: Export named CSS values
Loading
Possibly related PRs
actualbudget/actual#9499: It uses the shared theme object whose values this change generates from the color-token map.
actualbudget/actual#9312: It defines a custom light theme that mirrors the built-in --color-* tokens generated from the token map in this change.
Suggested reviewers:matissjanis, youngcw
Merge Risk: Minimal · previous review fecbc
No actionable issue was established; the generated themes preserve the prior definitions, and the updated consumers use the new exports. This change is ready for normal merge checks.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly summarizes the main change: defining theme colors in one source file.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description explains the theme-token changes, their goal of standardizing themes, and the intended benefit for custom theme authors.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is a first step in trying to clean up and standardise some tokens and reduce the amount of work that custom theme authors have to do to keep up with our changes, but also to initially create themes. The idea is the fewer tokens the better, and the more cohesive the app will look as a result.
This PR changes how the themes work, instead of defining each token for each theme in their own files, let's just do it in one place and use ts to get good typechecking on the whole lot. Stops us from running into issues like #9498 where one theme was missing some tokens.
Related issue(s)
Testing
VRT should not change
Checklist
Bundle Stats
View detailed bundle stats
desktop-client
Total
Changeset
home/runner/work/actual/actual/packages/component-library/src/themes/source/colors.tshome/runner/work/actual/actual/packages/component-library/src/themes/source/palette.tshome/runner/work/actual/actual/packages/component-library/src/themes/source/generate.tshome/runner/work/actual/actual/packages/component-library/src/themes/index.tssrc/style/theme.tsxhome/runner/work/actual/actual/packages/component-library/src/theme.tshome/runner/work/actual/actual/packages/component-library/src/themes/dark.css?inlinehome/runner/work/actual/actual/packages/component-library/src/themes/midnight.css?inlinehome/runner/work/actual/actual/packages/component-library/src/themes/light.css?inlinehome/runner/work/actual/actual/packages/component-library/src/themes/palette.css?inlineView detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
Smaller
Unchanged
loot-core
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
api
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
cli
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
crdt
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged