Repository navigation
Paint the scene only on the theme's own page background - #38
Closed
NguyenDTAnh wants to merge 1 commit into
Closed
NguyenDTAnh wants to merge 1 commit into
NguyenDTAnh wants to merge 1 commit into
Conversation
NguyenDTAnh
force-pushed
the
fix/panels-under-dialogs
branch
from
October 13, 2026 17:50
7147040 to
7bc025d
Compare
The engine guessed the page color as the most common one in the frame. On a session with a screenful of messages, tool output or code, the most common color is the message block's own surface, so the engine took that for the page and painted the scene into the blocks. It recomputes its surfaces, and the tint it applies to them, every tenth frame and holds color changes under 3 levels, so those cells flip back and forth, which is the flicker. The plugin already has the real page color: `context.theme.background.base`. Pass it in and paint the scene only on cells the UI filled with it. Every other background - a dialog, a menu, a message or tool block, the prompt - belongs to the UI. Without it the engine still falls back to the most common color, so `dev/mock.ts` and the checks are unchanged. Measured on a real session (Opencode 2.0.28, 160x45, dusk-aurora, `ocean`): after the change, no cell the UI painted with a non-page background is repainted by the engine, and no engine octant glyph lands on one (0, was 783 repaints and 252 glyphs with the earlier heuristic).
NguyenDTAnh
force-pushed
the
fix/panels-under-dialogs
branch
from
October 13, 2026 23:59
7bc025d to
20ae146
Compare
Author
|
Closing: the approach is wrong. The engine reads each cell's background color to decide what the scene may paint, but OpenTUI renders only the cells that changed, so a cell the UI did not repaint still holds the scene color from a previous frame. Restricting the scene to the theme's page color therefore makes the wallpaper vanish, and the original heuristic paints into dialogs, menus and message blocks. The right fix needs the frame diff (current buffer vs the buffer the engine wrote last frame) or a per-frame ownership mask from the host; I've rewritten issue #37 with the evidence. |
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.
Fixes the flicker in #37.
On a dark theme the wallpaper paints into dialogs, menus, the prompt, and the message, tool and code blocks in a session. The engine guessed the page color as the most common one in the frame, and on a session with a screenful of messages or tool output the most common color is those blocks' own surface - so the engine took it for the page and painted the scene into them. It recomputes its surfaces, and the tint it applies to them, every tenth frame and holds color changes under 3 levels back, so those cells flip back and forth, which reads as the block flashing.
The plugin already has the real page color:
context.theme.background.base. This passes it into the engine and paints the scene only on cells the UI filled with it. Every other background - a dialog, a menu, a message, a tool block, the prompt - belongs to the UI. When the page color is not passed in the engine still falls back to the most common color, sodev/mock.tsand the checks are unchanged.Measured on a real session (OpenCode 2.0.28, 160x45,
dusk-aurora,ocean):dev/panels.tscovers the dialog case on a mock screen: a dialog window over adusk-aurora-like scene carries no scene glyphs and is not repainted on surface recounts, on every wallpaper it is run against.bun dev/panels.ts ocean(and the other wallpapers): okbun dev/check.ts --quiet: 126 runs, 0 failedbun run typecheck: clean forsrc/andtui.tsxThe scene no longer glows through surfaces that are a touch off the page color, which is what
TINT_RANGEdid for animated highlights; a highlight that is not the page color now reads as the UI's own.