Search code examples
csscolorscss-selectorshtml-selectmaterialize

How to change color of Materialize multiple select checkbox?


How can I change the teal color of the Materialize multiple select checkboxes?

enter image description here

I'm able to change the color of the options:

enter image description here

ul.dropdown-content.select-dropdown li span {
    color: #E63594; 
}

And the color of the headings/selections:

enter image description here

.select-dropdown {
    color: red;
}

Solution

  • For the checkmarks, use:

    [type="checkbox"]:checked+span:not(.lever):before {
    
        border-right: 2px solid firebrick !important;
        border-bottom: 2px solid firebrick !important;
    
    }
    

     document.addEventListener('DOMContentLoaded', function() {
        var elems = document.querySelectorAll('select');
        var instances = M.FormSelect.init(elems,{
        isMultiple:true});
      });
    [type="checkbox"]:checked+span:not(.lever):before {
    
        border-right: 2px solid firebrick !important;
        border-bottom: 2px solid firebrick !important;
      
    }
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" rel="stylesheet"/>
    
    
     <div class="input-field col s12">
        <select multiple>
          <option value="" disabled selected>Choose your option</option>
          <option value="1">Option 1</option>
          <option value="2">Option 2</option>
          <option value="3">Option 3</option>
        </select>
        <label>Materialize Multiple Select</label>
      </div>