If theme colors are specified in OKLCH format, fallback colors are not generated for older browsers #7312
Closed
1 task done
Labels
Not planned
Issues that are not planned to be fixed or features that are not planned to be added
Dependencies check up
What version of @mantine/* packages do you have in package.json?
7.15.2
What package has an issue?
@mantine/core
What framework do you use?
Next.js
Describe the bug
As per the official Colors documentation, OKLCH is a supported color format.
Mantine inserts colors as inline CSS variables into the body inside of
<style data-mantine-styles="true">
.When specifying OKLCH colors as theme colors, these variables will only be defined in OKLCH notation, without any fallback value in HEX.
This means older browsers (such as Safari on iOS 15) will not be able to render the color.
A common solution when using OKLCH colors is to install a polyfill for supporting older browsers, such as the PostCSS OKLab Function plugin.
I’ve already configured the PostCSS OKLab Function plugin in my project,
postcss.config.cjs
:This will help process any custom CSS modules I write, but it doesn’t seem to affect the theme color variables generated by Mantine.
Possible fix
When OKLCH color values are used in the theme object, Mantine should use a polyfill like the PostCSS OKLab Function plugin to generate fallback colors in HEX.
This could be included as part of
postcss-preset-mantine
, with an optional configuration option for supporting Display P3 colors.The text was updated successfully, but these errors were encountered: