-
Notifications
You must be signed in to change notification settings - Fork 756
Open
Labels
Description
As currently specced the color input never renders the actual chosen color. We need to specify styles specific to the color input. This will track that.
Proposed additions
::color-swatch {
/* Ensures contrast between chosen color and button background (which by default is transparent so the page background) */
border: 1px solid currentColor;
/* Ensures it fills it's parent container */
flex: 1;
inline-size: 2em;
/* Should this be here? It's designed to prevent forced dark mode from messing with the colour? */
color-scheme: light only;
/* Prevents forced colors mode breaking the input */
forced-color-adjust: none;
/* This uses a linear gradient to handle showing the alpha of the control value. */
background: linear-gradient(control-value(<color>)),
linear-gradient(to bottom right, black 50%, white 50%);
box-sizing: border-box;
}This should result in the below rendering given <input type="color" value="color(srgb 0 1 0 / 0.75)" alpha>
