lundi 19 octobre 2020

How can I change the "checked" background color of this Bootstrap 4 toggle switch?

I can't figure out how to change the "checked" background color of this Bootstrap 4 toggle switch. It uses an extra library to toggle dark and light mode – Here on github – but that works. All I want to do is change the background color of the active checkbox, which is by default blue. Does it default to blue from the Bootstrap CSS? This answer Change Bootstrap 4 checkbox background color doesn't work for me; it changes the unchecked color, but I can't grep from it how to change the checked color.

Fiddle here

My code here:

.custom-control-input {
  background-color: red;
}
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<div class="custom-control custom-switch">
  <input type="checkbox" class="custom-control-input" id="darkSwitch" />
  <label class="custom-control-label" for="darkSwitch">Dark Mode</label>
</div>



Aucun commentaire:

Enregistrer un commentaire