I think there is no good answer to your question. Not with the current or next available version (v4).
These special conditional classes are implemented in various components, such as tables, form controls, buttons, cards, tags, progress bars, group list items, links, and texts.
These components can have quite a few modifier rules for each existing conditional class, for example, for .btn-danger
.btn-danger:hover { color: #fff; background-color: #c9302c; border-color: #c12e2a; } .btn-danger:focus, .btn-danger.focus { color: #fff; background-color: #c9302c; border-color: #c12e2a; } .btn-danger:active, .btn-danger.active, .open > .btn-danger.dropdown-toggle { color: #fff; background-color: #c9302c; border-color: #c12e2a; background-image: none; } .btn-danger:active:hover, .btn-danger:active:focus, .btn-danger:active.focus, .btn-danger.active:hover, .btn-danger.active:focus, .btn-danger.active.focus, .open > .btn-danger.dropdown-toggle:hover, .open > .btn-danger.dropdown-toggle:focus, .open > .btn-danger.dropdown-toggle.focus { color: #fff; background-color: #ac2925; border-color: #8b211e; } .btn-danger.disabled:focus, .btn-danger.disabled.focus, .btn-danger:disabled:focus, .btn-danger:disabled.focus { background-color: #d9534f; border-color: #d9534f; } .btn-danger.disabled:hover, .btn-danger:disabled:hover { background-color: #d9534f; border-color: #d9534f; }
If you look at the source code, you will notice that again an example of buttons, the authors use mixins to generate rules for conditional classes:
// // Alternate buttons // .btn-danger { @include button-variant($btn-danger-color, $btn-danger-bg, $btn-danger-border); }
and somewhere else
$btn-danger-color: #fff !default; $btn-danger-bg: $brand-danger !default; $btn-danger-border: $btn-danger-bg !default;
and again, somewhere else
$brand-danger: #d9534f !default;
The rules are hardcoded in the source files, so the only way to achieve something here is to expand these files with new rules and add new colors, basically change the boot file and recompile it .
This is doable, but consider the following:
- You need to save the code (future updates may not be compatible with your overrides)
- You need additional tools and skills, at least how to work with sass and how to make your own version of bootstrap.
- You need to implement these additional conditional classes in many .sass files.
- Having a βpurple color,β as you say, would mean having a 3-4 color palette that you need to check for each component.
There is also a nomenclature problem: .btn-warning, .text-danger, .table-info, etc. have semantic meaning when you propose color names.
I do not see a very good continuation coming out of it.
Who defines the palette for each additional conditional class? These rules are weighted even in bytes; you do not want to have so many conditional classes to cover most users.
Instead, you may need a rule generator for each conditional class that you decide to add. A tool like this can be executed, but again, it must be supported as well as retro compatible. For example, there are 7 versions for more updated than yours (3.3.0, still in LESS) plus the new v4 (SASS) Is it worth it?
Usually these conditional classes are sufficient for most purposes, and if you want, generate custom bootstrap versions with different color combinations.