Skip to content

Share the colors between TypeScript and CSS - #66

Merged
chelproc merged 1 commit into
mainfrom
share-colors-with-css
Oct 31, 2026
Merged

chelproc merged 1 commit into
mainfrom
share-colors-with-css

Conversation

@chelproc

@chelproc chelproc commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Make the colors available to stylesheets as well as TypeScript.

  • Rename src/index.css to src/style.css and define the colors there as custom properties (--color-primary, --color-text-primary, …)
  • Define the same colors as theme.colors in src/style.ts; the two have to be kept in sync by hand
  • Import theme from src/style.ts directly, rename theme.palette to theme.colors, and leave only the MUI theme in src/common/theme.ts

The colors / --color-* naming follows the System UI theme specification and Tailwind CSS.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Deploying create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee with  Cloudflare Pages  Cloudflare Pages

Latest commit: 642ed4d
Status: ✅  Deploy successful!
Preview URL: https://8839e768.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev
Branch Preview URL: https://share-colors-with-css.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev

View logs

@chelproc
chelproc force-pushed the share-colors-with-css branch from 9fe54ed to fb86e90 Compare October 31, 2026 03:27
Rename index.css to style.css and define the colors there as custom
properties named --color-*, so that stylesheets can use them. Define the
same colors as `theme.colors` in style.ts next to it, and import them
from there directly. theme.ts now only holds the MUI theme.
@chelproc
chelproc force-pushed the share-colors-with-css branch from fb86e90 to 642ed4d Compare October 31, 2026 03:30
@chelproc
chelproc merged commit 558b6ea into main Oct 31, 2026
2 checks passed
@chelproc
chelproc deleted the share-colors-with-css branch October 31, 2026 03:32
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.

1 participant