Skip to content

Commit 0b2dc92

Browse files
authored
[css-forms-1] Add styles for ::color-swatch (#13598)
1 parent ce9a132 commit 0b2dc92

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

css-forms-1/Overview.bs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,15 +820,14 @@ spec:css-forms-1; type:value; for:/; text:::placeholder
820820

821821
ISSUE: This section needs refining with implementation.
822822

823-
ISSUE(11837): Color input styles need refining.
824-
825823
## Basics ## {#stylesheet-basics}
826824

827825
```css
828826
input,
829827
textarea,
830828
button,
831829
::file-selector-button,
830+
::color-swatch,
832831
select,
833832
meter,
834833
progress,
@@ -1041,6 +1040,27 @@ input[type="file"]:disabled::file-selector-button {
10411040
}
10421041
```
10431042
1043+
## Color Input ## {#stylesheet-color}
1044+
1045+
```css
1046+
input[type="color"] {
1047+
padding: 0;
1048+
overflow: clip;
1049+
}
1050+
1051+
::color-swatch {
1052+
inline-size: stretch;
1053+
block-size: stretch;
1054+
1055+
/* These prevent forced dark mode or forced colors mode from changing the background. */
1056+
color-scheme: light only;
1057+
forced-color-adjust: none;
1058+
1059+
/* Uses a linear gradient to handle showing the alpha channel of chosen color */
1060+
background: linear-gradient(control-value()), linear-gradient(to bottom right, black 50%, white 50%);
1061+
}
1062+
```
1063+
10441064
## Selects ## {#stylesheet-select}
10451065
10461066
```css

0 commit comments

Comments
 (0)