You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 869521b
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: .changeset/css-color-strings.md
+18-7Lines changed: 18 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,35 @@
1
1
---
2
-
'@bomb.sh/tty': minor
2
+
"@bomb.sh/tty": minor
3
3
---
4
4
5
5
Adds CSS color string support to every color field in `@bomb.sh/tty`.
6
6
7
-
`open({ bg })`, `border.color`, `border.bg`, per-side `color`/`bg`, and `text({ color, bg })` now accept CSS Color 4 strings in addition to packed ARGB numbers from `rgba()`.
7
+
`open(id, { bg })`, `border.color`, `border.bg`, per-side `color`/`bg`, and
8
+
`text(content, { color, bg })` now accept CSS Color 4 strings in addition to
Colors are resolved to sRGB at the transfer-encoding boundary; the wire format, snapshot encoding, and renderer are unchanged. Out-of-gamut colors (common with `lab()`/`oklch()`) clip per channel. Invalid strings are rejected by `validate()` and throw a `TypeError` from the packer before any bytes are produced.
19
+
Colors are resolved to packed sRGB ARGB values when directives are encoded for
20
+
the renderer. Out-of-gamut colors (common with `lab()`/`oklch()`) clip per
21
+
channel. Invalid strings are rejected by `validate()` and cause `render()` to
22
+
throw a `TypeError` before returning output.
16
23
17
-
String literals assigned to color fields are also checked at compile time in TypeScript: invalid hex digit counts, misspelled named colors, and unsupported function names are type errors.
24
+
String literals assigned to color fields are also checked at compile time in
25
+
TypeScript: invalid hex digit counts, misspelled named colors, and unsupported
26
+
function names are type errors.
18
27
19
28
#### Migration
20
29
21
-
Color fields were previously typed `number`; they are now typed `number | string`. Existing `rgba()` calls and numeric color values are unaffected.
30
+
Color fields were previously typed `number`; they are now typed
31
+
`number | string`. Existing `rgba()` calls and numeric color values are
0 commit comments