Skip to content

refactor(styles): replace arbitrary color values with named Tailwind tokens#8166

Open
sujalgoel wants to merge 2 commits intowebpack:mainfrom
sujalgoel:tailwind-consolidation
Open

refactor(styles): replace arbitrary color values with named Tailwind tokens#8166
sujalgoel wants to merge 2 commits intowebpack:mainfrom
sujalgoel:tailwind-consolidation

Conversation

@sujalgoel
Copy link
Copy Markdown
Contributor

Summary

Part of #8047. Replaces hardcoded hex values across the CSS files with named Tailwind v4 theme tokens defined in a single source-of-truth file.

  • Added src/styles/theme.css with a @theme block defining all semantic color tokens (brand, heading, aside/callout, table, code, dark mode surfaces)
  • Updated src/styles/index.css to use @import "tailwindcss" so theme tokens are emitted as CSS custom properties, and to import theme.css before dark.css
  • Replaced ~20 arbitrary values in src/styles/dark.css with named tokens (bg-[#121212] -> bg-dark-bg, bg-[rgba(70,94,105,0.45)] -> bg-dark-code-inline-bg, etc.)
  • Replaced ~18 arbitrary values in Markdown.css with named tokens for heading, aside, table, and code styles; added @reference "../../styles/theme.css" for token access
  • Merged inline style={{ background: "none", border: "none" }} into className in MessageBar.jsx

No colors change. Same hex values, now with names.

What kind of change does this PR introduce?

Refactor. No behavior or visual changes.

Did you add tests for your changes?

No.

Does this PR introduce a breaking change?

No.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

N/A

Use of AI

No.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webpack-js-org Ready Ready Preview, Comment Apr 6, 2026 6:41pm

Request Review

@@ -0,0 +1,72 @@
@theme {
/* Brand link colors */
--color-brand-link: #1a6bac;
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.

@copilot does these variabels use the same palette as the ones in https://github.com/webpack/media ?

Copy link
Copy Markdown
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

looks good, let's recheck color values and we can emrge

@TusharThakur04
Copy link
Copy Markdown
Contributor

  • Font style has been changed, please compare the preview with the currently deployed upstream
  • splash color in light mode isnt correct :
Screenshot from 2026-04-06 23-11-49

@sujalgoel
Copy link
Copy Markdown
Contributor Author

Strange! I will take a look @TusharThakur04 thank you.

…me tokens

@import "tailwindcss" caused two regressions: Tailwind's base layer
overrode the site font, and spacing utilities switched from fixed pixel
values to calc(var(--spacing) * N), breaking layout across the board.

Switch back to @reference "tailwindcss" to avoid emitting preflight and
the default theme. Add an explicit :root block in theme.css that mirrors
the @theme tokens so var(--color-*) references resolve at runtime for
dark mode and other dynamic styles.
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.

4 participants