Repository navigation
feat: currentcolor and inherited open() color - #158
Draft
natemoo-re wants to merge 3 commits into
Draft
natemoo-re wants to merge 3 commits into
natemoo-re wants to merge 3 commits into
Conversation
Contributor
Changeset suggestionThe current changeset no longer matches this PR. This review contains a corrected replacement. Why: Changeset should start with an approved active present-tense verb. Changeset package scope does not match the affected packages confidently. View the proposed changeset---
'@bomb.sh/tty': minor
---
Adds `color` to `open()`: the element's own foreground color, inherited by every descendant that does not set its own.
`currentcolor` is now a valid color string at every color field. In `open({ color })` and `text({ color })` it means "inherit" (same as omitting the field); in any other field — `bg`, `border.color`, `border.bg`, or a structured border side's `color`/`bg` — it resolves to the directive's own resolved foreground, then follows normal field resolution (terminal-themed, probed-theme, or sRGB passthrough). `border.color` is now optional and defaults to `currentcolor`, matching CSS.
#### Migration
`border.color` was previously required. Existing code that supplies it is unaffected. Code that relied on a missing `border.color` being a validation error must now supply an explicit color to override inheritance:
```diff
open("box", {
border: {
- color: "red", // was required; remove to inherit, or keep to override
+ color: "red",
top: 1,
},
})
```
If you were checking `validate()` against a border with no `color`, that case now returns `true` instead of `false`.Review this changeset manually If this draft is correct, react with 🚀 and Cooper will commit it to this branch. |
| @@ -0,0 +1,16 @@ | |||
| --- | |||
Contributor
There was a problem hiding this comment.
Changeset needs revision.
Changeset should start with an approved active present-tense verb. Changeset package scope does not match the affected packages confidently.
View the proposed replacement
---
'@bomb.sh/tty': minor
---
Adds `color` to `open()`: the element's own foreground color, inherited by every descendant that does not set its own.
`currentcolor` is now a valid color string at every color field. In `open({ color })` and `text({ color })` it means "inherit" (same as omitting the field); in any other field — `bg`, `border.color`, `border.bg`, or a structured border side's `color`/`bg` — it resolves to the directive's own resolved foreground, then follows normal field resolution (terminal-themed, probed-theme, or sRGB passthrough). `border.color` is now optional and defaults to `currentcolor`, matching CSS.
#### Migration
`border.color` was previously required. Existing code that supplies it is unaffected. Code that relied on a missing `border.color` being a validation error must now supply an explicit color to override inheritance:
```diff
open("box", {
border: {
- color: "red", // was required; remove to inherit, or keep to override
+ color: "red",
top: 1,
},
})
```
If you were checking `validate()` against a border with no `color`, that case now returns `true` instead of `false`.|
Size Increased — +9.0 KB 142.5 KB unpacked |
commit: |
natemoo-re
force-pushed
the
feat/currentcolor
branch
3 times, most recently
from
December 1, 2026 02:25
c745fd3 to
feb2218
Compare
Replaces the "currentcolor is reserved" wording. open() gains a color field, inherited by descendants unless overridden; currentcolor means "inherit" in a color field and "this directive's own resolved color, field-resolved like any other color" everywhere else. border.color becomes optional, defaulting to currentcolor. Inheritance is a pack()-time stack scoped to one frame's directive array.
open() gains a color field: the element's own foreground, inherited by descendants via a pack()-time stack pushed on open and popped on close. currentcolor means "inherit" in a color field and "this directive's own resolved color" everywhere else, going through the same field resolution (resolveForField) as any other color. border.color is now optional and defaults to currentcolor. resolveColor() returns a CURRENT_COLOR sentinel for the keyword; ops.ts substitutes the inherited/own color before field resolution via resolveOwn()/colorValue(), both newly threading a `current` parameter through colorWord/sideFg/sideBg. No wire-format change: open()'s own color has no direct rendering, only TS-side inheritance.
natemoo-re
force-pushed
the
feat/currentcolor
branch
from
December 1, 2026 04:23
feb2218 to
df03123
Compare
Inheritance, currentcolor, and system color field resolution move from pack() to the renderer, which resolves them over the element tree of the frame being rendered and against the theme in effect for that render. Packing a directive no longer depends on its ancestors or on the theme, so a snapshot inherits from the position where it appears, and a theme report reaches snapshotted content on the next render. The same rule carries over to element replay. The transfer encoding gains symbolic color words for the two default keywords and currentcolor; cells keep resolved colors only. pack() drops its theme parameter; the theme lives in native state and crosses the boundary on update(), not on every render. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BzW3aAMCMjaCM4gYXZcWGb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
open()gets acolorfield. Nestedopen()s andtext()s inherit it unless they set their own, like CSScolor.currentcolorworks in every color field and means "this element's color". Ascoloritself, it means inherit.border.coloris now optional and defaults tocurrentcolor, so borders match the text color by default.currentcolornever throws. If the color it points at is the terminal default and it's used as a background, it paints the theme foreground the terminal reported, or falls back to the default background.