Change color of checkbox in Materialize framework

arnuga3 picture arnuga3 · Feb 8, 2016 · Viewed 14.4k times · Source

I am currently working with Materialize framework and wondering is it possible to change the colour of the filled-in checkbox as it is green on default.

<input type="checkbox" class="filled-in" id="filled-in-box" checked="checked" />
<label for="filled-in-box">Filled in</label>

Any ideas would be appreciated. Thanks

Answer

Lawshe picture Lawshe · Feb 10, 2016

Add a class to the checkbox input which will style the after pseudo-element of the label

.checkbox-orange[type="checkbox"].filled-in:checked + label:after{
     border: 2px solid #ff9800;
     background-color: #ff9800;
}
<input type="checkbox" class="filled-in checkbox-orange" id="filled-in-box" checked="checked" />
<label for="filled-in-box"></label>