A problem: I'd like to use a custom background color; unchecked checkboxes are "white" in this case. Here's the shortest illustration:
div {
background: yellow;
}
<div>
<input type="checkbox" />
</div>
A screenshot, just in case:
Now, I know that a basic approach would be to create a custom checkbox pseudoelement, but I still wonder if there's a "low-code" solution.
I also know that one can use accent-color
to style the "checked" state and color-scheme: dark;
for dark mode (see more detail here, for instance: they even say that browser ensures accessibility when using accent-color
by ensuring sufficient color contrast).
So, is there a way to set the background color of an unchecked checkbox without rebuilding it with a pseudoelement? (At least to inherit the main background color.) Looks like there's no way to create a custom color-scheme
(yet), but may be I've overlooked some other way?