How to create new set of color styles in Bootstrap 4 with sass

There is not an all inclusive color mixin, so I think you need to use the mixins individually...

.btn-custom {
    @include button-variant(#cece19, #222222, #cece19);
}

.btn-custom-outline {
    @include button-outline-variant(#222222);
}

.card-custom {
    @include card-variant(#aa9999, #997777)
}

http://www.codeply.com/go/MKGQCrLwDs


Update: In Bootstrap 4, you now can create a new custom "theme-color" to as explained in my answer here. This will allow you to use the color anywhere such as btn-custom, text-custom, bg-custom, etc...

Update Bootstrap 4.1

The button mixins have changed slightly and now require add'l params...

.btn-custom {
    @include button-variant(#cece19, #222222, #cece19, #cece19, #cece19, #cece19);
}

.btn-custom-outline {
    @include button-outline-variant(#222222, #cece19, #222222, #cece19);
}

@import "bootstrap";

You're in luck, because today I just released an online tool that does exactly that: https://lingtalfi.com/bootstrap4-color-generator.

It will generate the necessary css code (using sass or not as an option), and will generate the 10 color variations for bootstrap4 colors.

In the end, I recommend creating a custom "my_colors.css" (or my_colors.scss) file, and put all your generated colors in it.

Note that my tool only changes colors, it doesn't care about other properties (padding, font-size, etc...).

Hope this helps.


I create completely custom colors, and add colors by creating a custom.scss, adding the new theme colors, then compile it to custom.css. Below is an example of changing the theme colors as well as adding a new color (purple). Note that you need to import bootstrap.scss at the bottom of the file for this to work. Here's an example:

$theme-colors: (
   "primary": #7189bf,
   "secondary": #667,
   "success": #72d6c9,
   "info": #00aedb,
   "warning": #df7599,
   "danger": #ffc785,
   "purple": #b19cd9,
);

@import '../../bootstrap/scss/bootstrap';

There are other ways, I just find this the easiest for me. There's a lot more you can customize in bootstrap 4, and that can also be done in this file with variables etc.

I created a template that uses this method as well as showing what all elements look like with the new theme colors. I took what I found around the web and put it together for my use - feel free to use it for yours, or change it, etc.

Here's the link: https://github.com/steveshead/bootstrap4-elements-v2