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

  1. Install the site template (The Rightup) with Canvas.
  2. In Canvas > Brand kit, add a colour with the CSS variable --bs-primary.
  3. Change its value.
  4. 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

Command icon 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

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Title: Load the Drupal Canvas brand kit after the theme so its colours win » Let the Drupal Canvas brand kit override the theme colours
Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes

  • rajab natshah committed 900f7b91 on 1.0.x
    feat: #3639241 Let the Drupal Canvas brand kit override the theme...