Problem/Motivation
Drupal Canvas writes the brand kit colours as CSS custom properties on :root. When the brand kit uses Bootstrap 5.3's own variable names (--bs-primary, --bs-body-bg, ...), the theme's compiled :root values override them, because Drupal always sorts module CSS before theme CSS. So editing a colour in Canvas > Brand kit changes nothing.
Steps to reproduce
- Install the site template (The Rightup) with Canvas.
- In Canvas > Brand kit, add a colour with the CSS variable
--bs-primary. - Change its value.
- The site keeps the theme's primary colour.
Proposed resolution
Leave Canvas's CSS order as it is and make the theme give way. components/base/root/root.scss imports Bootstrap's root inside a cascade layer:
// The Root CSS3 variables for Bootstrap 5. @layer vartheme-root { @import "../../../node_modules/bootstrap/scss/root"; }
The theme's own accent and tertiary light colour variables after it go in the same layer. A cascade layer loses to the brand kit's :root { --bs-primary: ... }, which is in none, whatever the load order, so the brand kit wins and the theme's values stay the fallback. Dark mode values still apply inside [data-bs-theme="dark"], and everything else in the theme stays unlayered.
components/base/root/root.css is rebuilt from the SCSS: every custom property is identical to the target branch, only wrapped in the layer. The copied _bootstrap-root.scss partial and the earlier load-order hook are gone, so no PHP change remains.
Related: The Rightup recipe issue #3638673 and its merge request !104.
Remaining tasks
- ✅ File an issue
- ✅ Addition/Change/Update/Fix: Bootstrap's root imported in a cascade layer
- ❌ Testing to ensure no regression: default look identical to the target branch on 2 pages, brand kit Primary followed with CSS aggregation on and off, dark values kept; pipeline still to pass
- ➖ Automated unit/functional testing coverage
- ➖ Developer Documentation support
- ➖ User Guide Documentation support
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ❌ Reviewed by a human
- ❌ Code review by maintainers
- ❌ Full testing and approval
- ❌ Credit contributors
- ❌ Review with the product owner
- ❌ Update Release Notes
- ❌ Release, before the The Rightup recipe change
User interface changes
- N/A
API changes
- N/A
Data model changes
- N/A
Release notes snippet
- The theme lets Drupal Canvas brand kit colours that use Bootstrap's variable names override its own colours, without changing Canvas's CSS order.
AI-Generated: Yes
Issue fork vartheme_bs5_rightup-3639241
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
rajab natshahComment #4
rajab natshahComment #5
rajab natshah