Replies: 1 comment
-
Looks like a good approach to me! Currently the btn-/color/ classes don't respect their respective color-variables which is a known issue. It looks like this on the rendered page: The biggest challenge in this approach is color-contrast. I don't think you can calculate that in realtime with native CSS right now so we need a preprocessor, or Javasript, or have the developer manually set a contrast-color. I hope some variant of this makes it into Bootstrap 6 :) |
Beta Was this translation helpful? Give feedback.
-
This is a work in progress. I don't know enough about color theory to manipulate the
-bs-primary-lighten-*
and-bs-primary-darken-*
in order to mimic what happens in Bootstrap when a color is tinted/shaded.I started this based on finding the word "primary" in https://github.com/twbs/bootstrap/blob/main/dist/css/bootstrap.css. All other classes including the word "primary" would need to be reviewed but for the most part, they all seem to already utilize CSS variables. "light" and "dark" are outliers and likely could be excluded from this.
The goal is to create something that makes it easier to override the Bootstrap colors when not compiling from Sass. Obviously this implementation is using Sass, but it could be compiled and the raw CSS copied for a pure CSS implementation.
Certain variables under the table styles would be overridden using the new
-lighten-*
variables. Since the background color of a table style is being lightened drastically, the font color could remain black and not have to be based off of the color pallete.Some sensible dark mode defaults would be nice for each color. Or perhaps it would be up to the developer to simply do this:
Again I don't know enough about color theory to get too deep into color manipulation for dark mode.
Beta Was this translation helpful? Give feedback.
All reactions