Discover the new SASS color theme in Bootstrap 5.3 with the addition of Subtle and Emphasis classes for

I'm in the process of enhancing my Bootstrap SASS theme with a new color scheme. I have a customized file that includes modifications and introduces a new color: GOLD.

After conducting extensive research and reading various resources, I successfully implemented the new theme for almost all elements, encompassing backgrounds and borders. For example, I added classes like text-gold, border-gold, btn-gold, bg-gold, etc.

However, despite following examples and documentation from Bootstrap, I am facing challenges creating "subtle" and "emphasis" classes such as border-gold-subtle, text-gold-emphasis, bg-gold-subtle, and others.

Is there a workaround to achieve this?

Below is a snippet of my code (I've omitted unrelated code blocks):

@import "functions"


$primary:   #2B4261 !default;
$secondary: #9FA6B2 !default;
$success:   #14A44D !default;
$info:      #54B4D3 !default;
$warning:   #E4A11B !default;
$danger:    #DC4C64 !default;
$light:     #FBFBFB !default;
$dark:      #332D2D !default;
$gold:      #AC863C !default;


$gold-bg-subtle:          tint-color($gold, 80%) !default;
$gold-border-subtle:      tint-color($gold, 60%) !default;


$gold-bg-subtle-dark:     shade-color($danger, 80%) !default;
$gold-border-subtle-dark: shade-color($primary, 40%) !default;

<!-- More code follows below... -->

@import "bootstrap";

Answer №1

Through further testing, a solution has been discovered. Sharing it here in case it proves beneficial to others.

The sequence of imports is CRUCIAL!

// --------------------------------------------------
@import "functions";
// --------------------------------------------------

$primary:   #2B4261 !default;
$secondary: #9FA6B2 !default;
$success:   #14A44D !default;
$info:      #54B4D3 !default;
$warning:   #E4A11B !default;
$danger:    #DC4C64 !default;
$light:     #FBFBFB !default;
$dark:      #332D2D !default;
$gold:      #AC863C !default;


$gold-text-emphasis:      shade-color($gold, 60%) !default;
$gold-text-emphasis-dark: tint-color($gold, 40%) !default;


$gold-bg-subtle:          tint-color($gold, 80%) !default;
$gold-bg-subtle-dark:     shade-color($gold, 80%) !default;


$gold-border-subtle:      tint-color($gold, 60%) !default;
$gold-border-subtle-dark: shade-color($gold, 40%) !default;


// --------------------------------------------------
@import "variables";
@import "variables-dark";
// --------------------------------------------------


$custom-colors: (
  "primary":   $primary,
  "secondary": $secondary,
  "success":   $success,
  "info":      $info,
  "warning":   $warning,
  "danger":    $danger,
  "light":     $light,
  "dark":      $dark,
  "gold":      $gold
);


$theme-colors: map-merge($theme-colors, $custom-colors);


// --------------------------------------------------
@import "maps";
@import "mixins";
// --------------------------------------------------


$custom-colors-text: ("gold": $gold);
$custom-colors-bg-subtle: ("gold": $gold-bg-subtle);
$custom-colors-border-subtle: ("gold": $gold-border-subtle);


$theme-colors-text: map-merge($theme-colors-text, $custom-colors-text);
$theme-colors-bg-subtle: map-merge($theme-colors-bg-subtle, $custom-colors-bg-subtle);
$theme-colors-border-subtle: map-merge($theme-colors-border-subtle, $custom-colors-border-subtle);


$custom-colors-text-dark: ("gold": $gold);
$custom-colors-bg-subtle-dark: ("gold": $gold-bg-subtle-dark);
$custom-colors-border-subtle-dark: ("gold": $gold-border-subtle-dark);


$theme-colors-text-dark: map-merge($theme-colors-text-dark, $custom-colors-text-dark);
$theme-colors-bg-subtle-dark: map-merge($theme-colors-bg-subtle-dark, $custom-colors-bg-subtle-dark);
$theme-colors-border-subtle-dark: map-merge($theme-colors-border-subtle-dark, $custom-colors-border-subtle-dark);


$utilities-text-emphasis-colors: map-merge($utilities-text-emphasis-colors, ("gold-emphasis": var(--#{$prefix}gold-text-emphasis)));
$utilities-bg-subtle:            map-merge($utilities-bg-subtle, ("gold-subtle": var(--#{$prefix}gold-bg-subtle)));
$utilities-border-subtle:        map-merge($utilities-border-subtle, ("gold-subtle": var(-{$prefix}gold-border-subtle)));


// --------------------------------------------------
@import "utilities";
// --------------------------------------------------


// Additional Information


// --------------------------------------------------
@import "bootstrap";
// --------------------------------------------------

=)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for achieving equal width li elements within various columns in Bootstrap 4 beta 2 and ensuring they span the full screen width

I've been scratching my head for a while, but I just can't seem to make it work. On the fiddle link provided, you'll notice three main blocks in light gray, each containing a variable number of smaller dark blocks. My goal is to have these s ...

Is there a way to access just the concealed text within an element?

Is there a way to create a JavaScript function that can specifically extract hidden text from an element? Are there any existing libraries with this capability, and if so, how efficient are they? In order for an element to be considered visible ac ...

What is the process for including icons on buttons?

I have been researching how to use Font Awesome software to incorporate icons into my HTML elements, but I am uncertain about the implementation process for my specific case. Currently, I have created a basic webpage with buttons and I would like to includ ...

Styling components using classes in Material-UI

I recently started using material-ui and noticed that it applies inline styles to each component. After running a test with multiple instances of the same component, I realized that there was no CSS-based styling - only repeated inline styles were generate ...

Webpack version 4.6.0 is currently loading a CSS file and it's suggesting the need for a suitable loader to manage this specific file

I have been encountering an issue with webpack 4.6.0 during compilation: Uncaught Error: Module parse failed: Unexpected token (1:4) You may need an appropriate loader to handle this file type. | div { | background-color: yellow; | color: red; He ...

The function cannot be applied to d[h] due to a TypeError

Having some trouble with my code here. I'm trying to set up routes to display a gif using CSS animation when the page is loading. The gif shows up initially, but then everything fades out and the gif remains on the page. Additionally, I'm getting ...

The "else" statement is never being executed

Trying to create a form where users enter their first name, last name, and city. If any input is empty or contains numbers, a message should appear requesting to fill out all boxes without numbers. Otherwise, display a personalized quote using the input in ...

Alignment of label not remaining centered vertically, issue with bootstrap

Struggling with getting this label to stay centered vertically? It always seems to appear at the top. Any help would be greatly appreciated. Thank you! Check out the code here <div class="container"> <div class="row"> <div clas ...

Google Map in Bootstrap FullScreen Mode Not Mobile-Friendly

Could you please take a look at the provided link and advise me on why the map is not responding correctly? I am also facing issues with the positioning of the map on the page, so any guidance on adjusting it appropriately would be greatly appreciated. Be ...

The continuation of unraveling the mystery of utilizing `overflow-y:scroll` in a horizontal slider

As a beginner, I realized too late that adding code in comments is not an option. Consequently, I decided to create a new question and ask for your assistance once again. To optimize the use of space, I have implemented bxSlider with fixed dimensions (wid ...

How to Incorporate the Angular Material Theme into Your Angular 17 Stackblitz Projects

Stackblitz's previous versions included a styles.css file where we could simply import prebuilt themes like this: @import "~@angular/material/prebuilt-themes/indigo-pink.css"; However, in the latest version of Stackblitz which utilizes glob ...

Style.css remains invisible to NetBeans

My webapp is built using Servlets and JSP. However, I am currently facing an issue with directing NetBeans to my style.css file. Whenever the stylesheet is placed in WEB-INF or META-INF or even outside them within the Web Pages directory, everything func ...

Is there a way to prevent Bootstrap offcanvas from causing the website to scroll?

Utilizing a Bootstrap offcanvas for a <nav> menu on a mobile site, I aim to navigate users to specific sections of the website when they click on a <li>. I've implemented a simple JavaScript script that triggers the offcanvas exit button a ...

Adding a text stroke to the <input type="text"/> element

    Can anyone provide a solution for implementing text stroke in <input type="text"/> that works across all major browsers (Firefox, Google Chrome, Safari, Opera, IE7+)? Is there any method using CSS 2.1 or jQuery to achieve this effect? ...

Tips for resizing a Shiny Dashboard to accommodate various screens

I created a shiny app with a specific layout on my desktop computer that fits perfectly on the screen. However, when I run the app on my notebook, only the top left boxes are visible, making the app too large for the screen. Even after resizing with Ctrl ...

Ways to update div attributes without using identifiers or classes

Is there a way to modify the content of a DIV element that does not have an ID or class? Here is a snippet of the code: <div id=1> <div id=2> <div id=3> <div id=4> <div><span>div without id ...

Just starting out with Boostrap; looking for ways to tidy up this code and achieve the intended effect

UPDATE: Check out the revised JS Fiddle link at the end of this post; I managed to achieve the desired result, but I believe there's room for improvement in the code! After experimenting with HTML/CSS for some time, I'm now working on my first l ...

What's the best way to ensure a paragraph element larger than its container is centered using bootstrap?

Need help with centering a paragraph element (email) that is larger than its container: https://i.sstatic.net/f3E55.png Here's the code I have so far: <div class="col-lg-2 col-lg-offset-1 text-center"> <a href="mailto:{{ site.email }}" ...

Issue with floating navigation bar functionality when resizing the page

After much tinkering, I have managed to create a floating navigation bar for my website. Most of the time, it works perfectly fine, but there's an issue when the window size is adjusted in the floating mode. Take a look at the image below for referenc ...

Present Images and Text Alongside Each Other in a Grid Layout

My goal is to have an image and text displayed side by side, but for some reason they are appearing stacked on top of each other. https://i.stack.imgur.com/F8OXL.png If you want to take a look at the code I am using, here is the link to my CodePen: https: ...