-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Remove color-mix() from packaged CSS via build-time transformation #2670
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: sy-records <33931153+sy-records@users.noreply.github.com>
Co-authored-by: sy-records <33931153+sy-records@users.noreply.github.com>
Co-authored-by: sy-records <33931153+sy-records@users.noreply.github.com>
|
@copilot It should be replaced during the build process, not directly modified in the source code. |
- Revert source CSS files to use color-mix() functions - Create custom PostCSS plugin to replace color-mix at build time - Plugin transforms color-mix with CSS variables to pre-computed hex values - Source files remain clean and maintainable with color-mix - Build output contains no color-mix functions for compatibility Co-authored-by: sy-records <33931153+sy-records@users.noreply.github.com>
Changed to use a PostCSS plugin that replaces color-mix during the build process. Source files now keep the original color-mix() functions, and the transformation happens at build time. (commit 8d1aa58) |
Co-authored-by: sy-records <33931153+sy-records@users.noreply.github.com>
|
Looks like this results in issues with Dark Mode:
While the expected Dark Mode appearance is this: Is this change something we need to pursue at this time? Looks like color-mix is already supported for just over 92% https://caniuse.com/?search=color-mix. I also don't know if the underlying reasons why John choose to use the function in the new core theme. |
|
Let's discuss this in #2669. |


The
color-mix()CSS function has limited browser support (Safari < 16.2, Firefox < 113, Chrome < 111). This PR removescolor-mix()from packaged CSS files during the build process while keeping source files maintainable.Changes
Created custom PostCSS plugin (
build/postcss-replace-color-mix.cjs):color-mix()functions during the CSS build process--color-mono-1through--color-mono-9): Values computed from#fffand#333--theme-color-1through--theme-color-8): Values computed from#0b85d7#212121(light),#e9e9e9(dark)rgba(11, 133, 215, 0.1)for transparencyUpdated PostCSS configuration (
postcss.config.cjs):Source files remain unchanged:
color-mix()functions for maintainabilityBuild Process
Source (maintainable):
Build output (compatible):
Verification
color-mix()instances (unchanged)color-mix()functionsThe transformation happens automatically during
npm run build:css, ensuring developers can use modern CSS while users get compatible output.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.