Repository navigation
Paint radial gradients, and fade a gradient into the terminal's background - #201
Merged
Merged
Conversation
…round A gradient cell that is not opaque now carries its alpha to the cell it lands on, which blends it with what is already there or with the background the terminal reported. Before, a gradient over nothing took its own color at half opacity or more and painted nothing below that, which drew a fade to transparent as a hard edge. Canvas and the other system colors that stand for the terminal's background are stops: the reported color, or no paint where the terminal has reported none. getComputedStyle() reads them as the reported color too. radial-gradient() and repeating-radial-gradient() read their shape, size and center as css-images-3 writes them, and a circle is round on the screen whatever shape the cells are. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GVbRv5n8btiCtaRBtLrLig
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GVbRv5n8btiCtaRBtLrLig
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GVbRv5n8btiCtaRBtLrLig
brainkim
force-pushed
the
feat/gradients
branch
from
November 24, 2026 15:11
0012911 to
d4780e6
Compare
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GVbRv5n8btiCtaRBtLrLig
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.
Three gradient changes asked for from dim, whose intro screen draws a glow.
A fade to transparent blends instead of cutting
linear-gradient(to bottom left, #a88400, transparent)over a box with no background of its own drew a hard staircase: each cell took the gradient's color at half opacity or more and nothing below that. A flat translucentbackground-coloralready blended with the terminal's reported background; the gradient path did not.A gradient cell that is not opaque now carries its alpha, and the cell it lands on blends it as it does any translucent fill: with what is already painted there (the element's own
background-color, or an ancestor's), or with the background the terminal reported. Theunderargument torenderGradientis gone, since the cell knows what is under it better than the element's style does.A terminal that reports no background still gets the half-opacity cut. There is nothing to blend with.
Canvas resolves to the terminal's background
Canvas(and the other system colors that stand for the terminal's background) is the reported color. Where none was reported it is a transparent stop, which leaves the cell to the terminal. Before, it made the whole gradient invalid.getComputedStyle()reads those colors as the reported background. It read black or white by the color scheme, and still does until the terminal answers.CanvasTextis unchanged: the terminal's text color is not asked for.radial-gradient()andrepeating-radial-gradient()The shape (
circle,ellipse), the size (the four extent keywords, a circle's radius, an ellipse's two radii) and the center (at, in the one- and two-value forms of<position>) parse as css-images-3 §3.2 writes them. A row counts for as many columns as a cell is taller than wide, as it does for a linear gradient's angle, so a circle is round on the screen.Not read: the three- and four-value forms of
<position>(at left 2ch top 1px), which make the gradient invalid, andconic-gradient().parseLinearGradientis renamedparseGradient. It is internal.Tests
tests/gradients.test.tsgains 14 tests: the fade against a reported background, against none, and against an ancestor's fill; Canvas as a stop and as a computed value; the radial grammar and what it rejects; and painted radial gradients (symmetry, roundness on 1:2 cells, an ellipse sized to its sides, an off-center circle, repeating rings, a glow fading into the terminal's background). The styling guide andexamples/gradients.tscover the new functions.The full suite passes on Node. On Bun one run failed a test in
tests/memory.test.ts, which then passed three times alone.🤖 Generated with Claude Code
https://claude.ai/code/session_01GVbRv5n8btiCtaRBtLrLig