Skip to content

🎨 define theme colors in a single source file - #9508

Merged
matt-fidd merged 2 commits into
masterfrom
theme-token-source
Nov 10, 2026
Merged

matt-fidd merged 2 commits into
masterfrom
theme-token-source

Conversation

@matt-fidd

@matt-fidd matt-fidd commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

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

  • 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

Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 39 14.83 MB → 14.72 MB (-112.05 kB) -0.74%
loot-core 1 5.41 MB 0%
api 2 4.32 MB 0%
cli 1 420.19 kB 0%
crdt 1 11.15 kB 0%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
39 14.83 MB → 14.72 MB (-112.05 kB) -0.74%
Changeset
File Δ Size
home/runner/work/actual/actual/packages/component-library/src/themes/source/colors.ts 🆕 +19.68 kB 0 B → 19.68 kB
home/runner/work/actual/actual/packages/component-library/src/themes/source/palette.ts 🆕 +2.11 kB 0 B → 2.11 kB
home/runner/work/actual/actual/packages/component-library/src/themes/source/generate.ts 🆕 +1.4 kB 0 B → 1.4 kB
home/runner/work/actual/actual/packages/component-library/src/themes/index.ts 🆕 +306 B 0 B → 306 B
src/style/theme.tsx 📉 -10 B (-0.11%) 8.99 kB → 8.98 kB
home/runner/work/actual/actual/packages/component-library/src/theme.ts 📉 -13.1 kB (-98.66%) 13.27 kB → 182 B
home/runner/work/actual/actual/packages/component-library/src/themes/dark.css?inline 🔥 -12.31 kB (-100%) 12.31 kB → 0 B
home/runner/work/actual/actual/packages/component-library/src/themes/midnight.css?inline 🔥 -12.27 kB (-100%) 12.27 kB → 0 B
home/runner/work/actual/actual/packages/component-library/src/themes/light.css?inline 🔥 -12.2 kB (-100%) 12.2 kB → 0 B
home/runner/work/actual/actual/packages/component-library/src/themes/palette.css?inline 🔥 -2.52 kB (-100%) 2.52 kB → 0 B
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
static/js/theme.js 30.73 kB → 38.71 kB (+7.98 kB) +25.97%

Smaller

Asset File Size % Changed
static/js/TransactionList.js 170.28 kB → 87.15 kB (-83.14 kB) -48.82%
static/js/DateSelect.js 2.68 MB → 2.65 MB (-36.9 kB) -1.34%

Unchanged

Asset File Size % Changed
static/js/index.js 2.67 MB 0%
static/js/AutomaticSyncSettings.js 21.95 kB 0%
static/js/BackgroundImage.js 121.09 kB 0%
static/js/FormulaEditor.js 771.38 kB 0%
static/js/NotesTagFormatter.js 30.87 kB 0%
static/js/ReportRouter.js 2 MB 0%
static/js/TourHost.js 169.78 kB 0%
static/js/TransactionEdit.js 276.07 kB 0%
static/js/Value.js 1.75 MB 0%
static/js/bootstrapHyperFormula.js 302 B 0%
static/js/build-shims.js 140 B 0%
static/js/ca.js 161.65 kB 0%
static/js/columns.js 686.43 kB 0%
static/js/de.js 177.77 kB 0%
static/js/definitions.js 490 B 0%
static/js/dist.js 15.13 kB 0%
static/js/en-GB.js 13.59 kB 0%
static/js/en.js 288.59 kB 0%
static/js/es.js 181.79 kB 0%
static/js/fr.js 174.54 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.46 kB 0%
static/js/it.js 147.14 kB 0%
static/js/months.js 612.04 kB 0%
static/js/narrow.js 297.43 kB 0%
static/js/nb-NO.js 130.04 kB 0%
static/js/nl.js 142.79 kB 0%
static/js/pl.js 140.69 kB 0%
static/js/pt-BR.js 169.12 kB 0%
static/js/rolldown-runtime.js 2.03 kB 0%
static/js/ru.js 197.48 kB 0%
static/js/uk.js 206.55 kB 0%
static/js/useLocalPref.js 101.16 kB 0%
static/js/web.js 1 kB 0%
static/js/wide.js 268.03 kB 0%
static/js/workbox-window.prod.es5.js 7.21 kB 0%
static/js/zh-Hant.js 127.83 kB 0%

loot-core

Total

Files count Total bundle size % Changed
1 5.41 MB 0%
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

Asset File Size % Changed
kcab.worker.CXDCAMi9.js 5.41 MB 0%

api

Total

Files count Total bundle size % Changed
2 4.32 MB 0%
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

Asset File Size % Changed
index.js 4.32 MB 0%
models.js 0 B 0%

cli

Total

Files count Total bundle size % Changed
1 420.19 kB 0%
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

Asset File Size % Changed
cli.js 420.19 kB 0%

crdt

Total

Files count Total bundle size % Changed
1 11.15 kB 0%
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

Asset File Size % Changed
index.js 11.15 kB 0%

@matt-fidd
matt-fidd added this pull request to stack #9500 November 10, 2026 16:37
@matt-fidd matt-fidd changed the title theme token source define theme colors in a single source file Nov 10, 2026
@netlify

netlify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit fecbca2
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget/deploys/6af3484cbe5840b641969ad1
😎 Deploy Preview https://deploy-preview-9508.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 10, 2026

Copy link
Copy Markdown

✅ Deploy Preview for actualbudget-storybook ready!

Name Link
🔨 Latest commit fecbca2
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget-storybook/deploys/6af3484caa8377d98ba41c77
😎 Deploy Preview https://deploy-preview-9508--actualbudget-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 1c1f84f
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget/deploys/6af350bf523535822a98bc30
😎 Deploy Preview https://deploy-preview-9508.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 10, 2026

Copy link
Copy Markdown

✅ Deploy Preview for actualbudget-storybook ready!

Name Link
🔨 Latest commit fecbca2
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget-storybook/deploys/6af3484c2462d3452d209830
😎 Deploy Preview https://deploy-preview-9508--actualbudget-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@matt-fidd

Copy link
Copy Markdown
Member Author

@coderabbitai review

@matt-fidd matt-fidd changed the title define theme colors in a single source file 🎨 define theme colors in a single source file Nov 10, 2026
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

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.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

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.

Changes: Theme Token Source

Layer / File(s) Summary
Define theme tokens
packages/component-library/src/themes/source/types.ts, packages/component-library/src/themes/source/palette.ts, packages/component-library/src/themes/source/colors.ts
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.
Export generated themes to consumers
packages/component-library/src/themes/index.ts, packages/component-library/src/themes/*.css, packages/component-library/package.json, packages/component-library/.storybook/preview.tsx, packages/desktop-client/src/style/theme.tsx, upcoming-release-notes/theme-token-source.md
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.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Sequence Diagram(s)

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: Passed 4

Check name Status Explanation
Title check Passed The title clearly summarizes the main change: defining theme colors in one source file.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed 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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e1eb60d and fecbca2.

Files selected for processing: 16

  • packages/component-library/.storybook/preview.tsx
  • packages/component-library/package.json
  • packages/component-library/src/theme.ts
  • packages/component-library/src/theme.web.test.ts
  • packages/component-library/src/themes/dark.css
  • packages/component-library/src/themes/index.ts
  • packages/component-library/src/themes/light.css
  • packages/component-library/src/themes/midnight.css
  • packages/component-library/src/themes/palette.css
  • packages/component-library/src/themes/source/colors.ts
  • packages/component-library/src/themes/source/generate.ts
  • packages/component-library/src/themes/source/generate.web.test.ts
  • packages/component-library/src/themes/source/palette.ts
  • packages/component-library/src/themes/source/types.ts
  • packages/desktop-client/src/style/theme.tsx
  • upcoming-release-notes/theme-token-source.md
Files with no reviewable changes: 5

  • packages/component-library/src/themes/dark.css
  • packages/component-library/src/themes/midnight.css
  • packages/component-library/src/themes/light.css
  • packages/component-library/src/themes/palette.css
  • packages/component-library/src/theme.web.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 10, 2026
@matt-fidd
matt-fidd marked this pull request as ready for review November 10, 2026 17:05
Base automatically changed from theme-no-raw-token-strings to master November 10, 2026 17:13

@youngcw youngcw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. No vrt issues and custom themes still seem to work perfectly

@matt-fidd

Copy link
Copy Markdown
Member Author

@MatissJanis your opinion here would be good too, I know you did a lot of the custom theme work

@matt-fidd
matt-fidd added this pull request to the merge queue Nov 10, 2026
Merged via the queue into master with commit 7aec2de Nov 10, 2026
43 checks passed
@matt-fidd
matt-fidd deleted the theme-token-source branch November 10, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants