There are no pre-existing Bootstrap native classes or mixins available for this specific task, but fear not! Bootstrap is designed to be easily extended: By using SASS, you can extend Bootstrap and generate the necessary helper classes on the go.
NOTE: The SASS code snippet provided below is tailored to address YOUR QUESTION (= all colors = 900 extra helper classes). You might consider customizing the code to only include the color classes that you truly require to minimize the additional code. Feel free to modify the code according to your preferences.
//### Ensure that you have imported bootstrap functions & variables beforehand
@import 'functions';
@import 'variables';
//### SASS function for extending Bootstrap
//### --> a quick and basic demo example!!!
@mixin make-color-classes( $class_prefix, $color_name, $color ){
// positive values = tint | negative values = shade
$swatch_variations: (80%, 60%, 40%, 20%, 0, -20%, -40%, -60%, -80%);
$i: 1;
@each $variation in $swatch_variations {
// process bootstrap color
@if ($variation > 0){
$swatch_color: tint($color);
}@else if ($variation < 0) {
$variation: $variation * -1;
$swatch_color: shade($color);
}@else{
$swatch_color: $color;
}
// generate class
$color_number: $i * 100;
.#{$class_prefix}-#{$color_name}-#{$color_number} {
color: tint-color($color, $variation );
}
$i: $i + 1;
}
}
//### NOW:
//### generate helper classes for a single color
@include make-color-classes('text', 'blue', $blue);
//### NOW ENHANCED:
//### generate helper classes for all named default bootstrap colors
$colors_to_use: $colors;
@each $color_name, $color in $colors_to_use {
@include make-color-classes('text', $color_name, $color);
}