If you want to set the background color for a checkbox
without using plugins or making custom modifications, there is a clever trick you can use. Simply employ the filter
rule with the parameter hue-rotate()
.
Additionally, you have the option to determine the value in degrees (deg
) by converting the RGB
code.
input[type="checkbox"]:nth-child(1):checked {
filter: hue-rotate(240deg);
}
input[type="checkbox"]:nth-child(2):checked {
filter: hue-rotate(285deg);
}
input[type="checkbox"]:nth-child(3):checked {
filter: hue-rotate(300deg);
}
input[type="checkbox"]:nth-child(4):checked {
filter: hue-rotate(320deg);
}
<input type="checkbox>
<input type="checkbox>
<input type="checkbox>
<input type="checkbox>
<input type="checkbox> <!--ORIGINAL-->