Reputation: 141
I would like to change the line color of the toggle button. i have tried to change the inline style of the Navbar.Toggle but it didnt work. Does someone have an idea?
Upvotes: 5
Views: 7390
Reputation: 1
If you want background is dark, but the hamburger is light, try this
<Navbar bg="dark" expand="lg" variant="dark">
Upvotes: 0
Reputation: 97
I just struggled with this for about an hour. Trying to change the stroke value in my sass to override the bootstrap default wasn't working for me, nor was any other deeper specificity rule that I tried.
What worked: Use a different background image and set it to !important. For example, I used the bootstrap "list" icon svg(downloaded from their site to an asset folder), which I set as the background for the same class that was being generated by bootstrap in the DOM:
.navbar-light .navbar-toggler-icon {
background-image: url("../assets/list.svg") !important;
}
Then, in the actual SVG file (click the file in your code editor to edit), change the "fill" or "stroke" attributes to whatever color you like. Easy peasy:
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="white" class="bi bi-list" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"/>
</svg>
Upvotes: 5
Reputation: 184
Try changing the variant to dark so that the hamburger will display as light to contrast with the "dark" variant of the navbar.
<Navbar bg="transparent" expand="lg" variant="dark">
Upvotes: 7
Reputation: 1001
Try the adding a class to the button (or just override the current class of the hamburger button) and do the following:
.navbar-hamburger {
background-image: url("data:image/svg+xml,<svg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'><path stroke='rgba(255,255,255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/></svg>");
}
And replace the stroke color. This was tested on plain bootstrap 4, I hope it works!
Upvotes: 1