Skip to content

Conversation

Copy link

Copilot AI commented Jan 20, 2026

The color-mix() CSS function has limited browser support (Safari < 16.2, Firefox < 113, Chrome < 111). This PR removes color-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):

  • Automatically replaces color-mix() functions during the CSS build process
  • Transforms 20 color-mix patterns to pre-computed values:
    • Monochrome scale (--color-mono-1 through --color-mono-9): Values computed from #fff and #333
    • Theme tints/shades (--theme-color-1 through --theme-color-8): Values computed from #0b85d7
    • Strong colors: #212121 (light), #e9e9e9 (dark)
    • Sidebar hover: rgba(11, 133, 215, 0.1) for transparency
  • Uses PostCSS 8 API with proper whitespace normalization

Updated PostCSS configuration (postcss.config.cjs):

  • Added custom plugin to build pipeline
  • Runs after nesting plugin but before minification

Source files remain unchanged:

  • All source CSS files retain color-mix() functions for maintainability
  • Developers can continue using modern CSS features
  • Build output automatically contains compatible CSS

Build Process

Source (maintainable):

--color-mono-1: color-mix(in srgb, var(--color-mono-min), var(--color-mono-max) 5%);
--theme-color-1: color-mix(in srgb, var(--theme-color), var(--color-mono-min) 90%);

Build output (compatible):

--color-mono-1: #f5f5f5;
--theme-color-1: #e7f3fb;

Verification

  • ✅ Source files contain 20 color-mix() instances (unchanged)
  • ✅ All packaged CSS files contain zero color-mix() functions
  • ✅ Build process completes successfully
  • ✅ All linting checks pass

The transformation happens automatically during npm run build:css, ensuring developers can use modern CSS while users get compatible output.

Original prompt

This section details on the original issue you should resolve

<issue_title>Remove color-mix from CSS [v5-rc]</issue_title>
<issue_description>### Problem or Desire

Remove color-mix from CSS during packaging to achieve better compatibility

Proposal

The packaged core.min.css product should not contain color-mix

Implementation Details

No response

Additional Context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

@vercel
Copy link

vercel bot commented Jan 20, 2026

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

Project Deployment Review Updated (UTC)
docsify-preview Ready Ready Preview, Comment Jan 20, 2026 4:25am

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 AI changed the title [WIP] Remove color-mix from CSS for compatibility Remove color-mix() from packaged CSS for browser compatibility Jan 20, 2026
Copilot AI requested a review from sy-records January 20, 2026 04:14
@sy-records
Copy link
Member

@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>
Copy link
Author

Copilot AI commented Jan 20, 2026

@copilot It should be replaced during the build process, not directly modified in the source code.

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>
Copilot AI changed the title Remove color-mix() from packaged CSS for browser compatibility Remove color-mix() from packaged CSS via build-time transformation Jan 20, 2026
@sy-records sy-records requested review from a team and paulhibbitts January 20, 2026 04:57
@paulhibbitts
Copy link
Member

Looks like this results in issues with Dark Mode:

2026-01-20_08-11-08

While the expected Dark Mode appearance is this:
2026-01-20_08-10-53

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.

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.

Remove color-mix from CSS [v5-rc]

3 participants