I am using a white background for a Carousel using Bootstrap 4.0 and would like to change the color of the controls. It seems that bootstrap now uses SVG for their carousel icons. This means altering the attributes directly does not work.
I am currently using Font Awesome for other elements on the site as well, so if there is a way to use fa-chevrons and format those instead, and it will still behave the same regarding resizing and formatting, that could be an effective solution as well.
Here is my current code for the control elements:
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
I found a similar question here but was not able to make sense of the answer provided there.
I also found this page on GitHub but was not able to make any of the answers there work for me either.
There's no need for any unnecessary css hacks.
If you want to modify any Bootstrap css (or the carousel control colors in particular), you can easily do that.
Here are the rules that control the color of the carousel controls:
Replace the
fff
in thefill='%23fff'
parts with the hex code of the desired color.Here's a working code snippet where
fill='%23fff'
has been replaced withfill='%23f00'
for red instead of white: