actual-css 0.19.4 → 0.19.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +2 -2
- package/dist/actual.full.css +6 -2
- package/dist/actual.full.min.css +1 -1
- package/docs/pages/forms/joined-controls.md +1 -1
- package/docs/pages/forms/switch.md +4 -2
- package/docs/pages/foundations/tokens.md +13 -13
- package/llms.txt +3 -3
- package/package.json +4 -5
- package/src/cli/actual-css.js +3 -3
- package/src/css/forms/switch.css +6 -2
- package/src/tooling/theme-contrast.js +6 -2
- package/docs/design-notes/accessibility-decisions.md +0 -63
- package/docs/design-notes/app-ui.md +0 -67
- package/docs/design-notes/architecture.md +0 -70
- package/docs/design-notes/browser-support.md +0 -239
- package/docs/design-notes/cascade-layer.md +0 -74
- package/docs/design-notes/column-layout.md +0 -260
- package/docs/design-notes/css-anchor.md +0 -87
- package/docs/design-notes/enhancement-contract.md +0 -193
- package/docs/design-notes/forced-colors.md +0 -123
- package/docs/design-notes/grid.md +0 -785
- package/docs/design-notes/motion-cost.md +0 -62
- package/docs/design-notes/naming.md +0 -71
- package/docs/design-notes/platform-alignment.md +0 -602
- package/docs/design-notes/popover-manual-poc.md +0 -328
- package/docs/design-notes/references.md +0 -336
- package/docs/design-notes/rich-text.md +0 -61
- package/docs/design-notes/spacing-units.md +0 -286
- package/docs/design-notes/steps.md +0 -776
- package/docs/design-notes/surface-reparenting.md +0 -130
- package/docs/design-notes/tokens.md +0 -166
- package/docs/design-notes/tooltip-coordinate-space.md +0 -130
- package/docs/design-notes/widget-primitives.md +0 -144
- package/docs/navigation.json +0 -176
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# Forced Colors (HCM) Strategy
|
|
2
|
-
|
|
3
|
-
## Principle: let the browser do the work
|
|
4
|
-
|
|
5
|
-
When `forced-colors: active`, the browser automatically remaps these properties to
|
|
6
|
-
the system palette:
|
|
7
|
-
|
|
8
|
-
- `border-color` → `ButtonText`
|
|
9
|
-
- `background` / `background-color` → `Canvas`
|
|
10
|
-
- `color` → `CanvasText`
|
|
11
|
-
|
|
12
|
-
This is the default behavior with `forced-color-adjust: auto` — and it applies to
|
|
13
|
-
**every** element, including pseudo-elements. Components do not need to redeclare
|
|
14
|
-
these properties in a forced-colors block.
|
|
15
|
-
|
|
16
|
-
## What the browser cannot understand
|
|
17
|
-
|
|
18
|
-
The browser sees `background-color`, `box-shadow`, `border-color`, `text-shadow`,
|
|
19
|
-
and non-URL `background-image` — it remaps or drops them all. It does **not**
|
|
20
|
-
understand:
|
|
21
|
-
|
|
22
|
-
- `mask-image` (SVG masks applied via `background-color`)
|
|
23
|
-
- Pseudo-elements whose `background-color` is used as a mask fill
|
|
24
|
-
- `box-shadow` used as a focus ring or shape indicator (the browser drops them)
|
|
25
|
-
- `background-image` carrying essential state or shape
|
|
26
|
-
|
|
27
|
-
These are the most common cases that need explicit forced-colors rules.
|
|
28
|
-
Add local overrides only when testing shows that browser remapping removes
|
|
29
|
-
an essential shape, state, or affordance.
|
|
30
|
-
|
|
31
|
-
## Pattern: custom property + single override
|
|
32
|
-
|
|
33
|
-
The hook-only form below is fine until an application overrides the hook: the
|
|
34
|
-
override sits at the same specificity, loads after the framework, and wins the
|
|
35
|
-
variable — leaving a non-system fill the browser then remaps to `Canvas`. For
|
|
36
|
-
a masked marker, write the forced value on the property itself so no hook
|
|
37
|
-
override can take it away (accordion) — same for range track/thumb fills.
|
|
38
|
-
|
|
39
|
-
```css
|
|
40
|
-
.component {
|
|
41
|
-
--cmp-marker-color: var(--text-muted);
|
|
42
|
-
|
|
43
|
-
background: ...
|
|
44
|
-
color: ...
|
|
45
|
-
border: ...
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.component::marker {
|
|
49
|
-
background-color: var(--cmp-marker-color);
|
|
50
|
-
mask-image: url(...);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@media (forced-colors: active) {
|
|
54
|
-
.component {
|
|
55
|
-
--cmp-marker-color: CanvasText;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/* Masked markers: pin the property, not just the hook. */
|
|
59
|
-
.component::marker {
|
|
60
|
-
background-color: CanvasText;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Color system keywords by role
|
|
66
|
-
|
|
67
|
-
| Context | Color | Why |
|
|
68
|
-
| ------------------------ | --------------------- | ---------------------------------- |
|
|
69
|
-
| Disclosure marker | `CanvasText` | Summary is on Canvas, not a button |
|
|
70
|
-
| Button, switch, checkbox | the `Button*` pair | Interactive controls |
|
|
71
|
-
| Selected / current state | the `Highlight*` pair | Matches OS selection |
|
|
72
|
-
| Disabled state | `GrayText` | Standard disabled system color |
|
|
73
|
-
| Hover indicator | outline or underline | Avoids blocked backgrounds |
|
|
74
|
-
|
|
75
|
-
Controls use `ButtonText` / `ButtonFace`, and `Highlight` / `HighlightText` for
|
|
76
|
-
their selected state. A hover indicator is a `ButtonText` outline or a
|
|
77
|
-
`CanvasText` underline.
|
|
78
|
-
|
|
79
|
-
Prefer `CanvasText` for non-interactive mark-up content. `CanvasText` and
|
|
80
|
-
`ButtonText` are **not guaranteed identical** — custom HCM palettes can set
|
|
81
|
-
them differently.
|
|
82
|
-
|
|
83
|
-
## What to avoid
|
|
84
|
-
|
|
85
|
-
### `forced-color-adjust: none`
|
|
86
|
-
Only use when the color **must not** be remapped — e.g., a `background-color`
|
|
87
|
-
whose value is `currentColor` (the system would turn it into `Canvas` and make
|
|
88
|
-
the element invisible). Every `forced-color-adjust: none` blocks the browser
|
|
89
|
-
from fixing contrast issues automatically. Most components need zero instances.
|
|
90
|
-
When only a pseudo-element carries essential color information, put the
|
|
91
|
-
declaration on that pseudo-element so the interactive host keeps native color
|
|
92
|
-
and focus adaptation.
|
|
93
|
-
|
|
94
|
-
### Redundant rules
|
|
95
|
-
```css
|
|
96
|
-
/* DON'T — the browser already does this */
|
|
97
|
-
@media (forced-colors: active) {
|
|
98
|
-
.component {
|
|
99
|
-
border-color: ButtonText;
|
|
100
|
-
background: Canvas;
|
|
101
|
-
color: CanvasText;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Redundant hover outlines
|
|
107
|
-
If the default focus is an outline on `:focus-visible`, it's already handled.
|
|
108
|
-
Hover doesn't need an outline duplicate. Reserve hover HCM rules for cases
|
|
109
|
-
where text-decoration (underline) is a better visual than an outline.
|
|
110
|
-
|
|
111
|
-
## Exemptions from forced-colors rules
|
|
112
|
-
|
|
113
|
-
Some components need **no** forced-color block at all because the default
|
|
114
|
-
remapping is perfect:
|
|
115
|
-
|
|
116
|
-
- `.card` — `background: Canvas`, `color: CanvasText` are already the defaults
|
|
117
|
-
- `.flyout` / `.menu` — `Canvas`/`CanvasText` for content, `ButtonText` for borders
|
|
118
|
-
- `.breadcrumb` — pure remapping gets everything right
|
|
119
|
-
- `.status-bar` — `CanvasText` on `Canvas` background
|
|
120
|
-
|
|
121
|
-
The only forced-colors rules that should remain after a full audit are the ones
|
|
122
|
-
truly required by pseudo-element masks (`::after` / `::before` chevrons, custom
|
|
123
|
-
check/radio marks), non-native focus rings, and `currentColor` dependencies.
|