blueprint: Unable to override default colors (e.g. `$blue2`) with node-sass or dart-sass in v4
After upgrade to v4 I am unable to override default colors (e.g. $blue2), even using node-sass. Has anything changed from v3 which would impact this?
_Originally posted by @dylangrandmont in https://github.com/palantir/blueprint/issues/4759#issuecomment-1080979948_
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 19 (12 by maintainers)
I was able to use this with partial success:
It successfully changes the font sizes, but not the colors.
@adidahiya I have the same problem, that my intent-overrides don’t work anymore and I’ve tried making the
@usesyntax work for multiple hours now without success. It seems to completely ignore those overrides and start the app with the default colors. I’ve read all the other issues and I know about the dart-sass breaking change, switched the compiling of the scss files to dart-sass as well with no success.For color-theming, all you basically need is the ability to override the different intent and text colors, so basically the content of the
_content-aliases.scssfile. This would probably fit the needs for most people.We really like blueprint as a foundation but since color overriding is broken for us now in version 4 and probably going forward we will have to switch away from it.
Going through the issues showed that there’s definetely a need for themeing. With a couple more intents (like for example bootstrap has) it should in theory be really easy to make themeing something that everybody can use without a huge hassle in terms of maintenance.
Regarding ideas how to make this available, why not give us a wrapper like
<Theme />which we can wrap around our whole application where you can set certain colors and stuff via properties.While css variables would be easier on end-users to override, I imagine it would be challenging to migrate to given the amount of sass math/operations that are happening with sass variables currently in blueprintjs. You cannot call sass methods using css variables, so the team would have to decide what variables are safe to expose at the surface level versus what variables remain internal (and thus usable in sass calculation operations).
In order to compile Blueprint’s scss, you must copy blueprint’s resource/icons folder to a path local to your repo, and setup your bundler with the svg-icon function. There are instructions here if you use webpack: https://blueprintjs.com/docs/#core/classes.namespacing
If you use Vite as your bundler, here is an example:
That would be a pretty large change to our Sass code and tooling. I’m generally open to exploring various technical options to accomplish an API goal like theming in Blueprint, but I’d need to see a proposal about how this would work, what code would need to change in Blueprint, how much of a breaking change it is, how we would migrate Blueprint user code, etc.
@adidahiya any thoughts on maybe using css variables instead of sass variables?