Repository navigation
Caret contrasts with the page colour, shading or highlight under it (#299) - #1137
Merged
Merged
Conversation
…r highlight under it The caret was black (white only in Switch Modes' dark page), so it vanished on a dark page colour, dark shading or a dark highlight. It now takes black or white by WCAG contrast with the background at the caret (wordcraft_render::background_at), cached per layout/view/position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dkhlapov
force-pushed
the
issue-299-caret-contrast
branch
from
October 12, 2026 23:36
242cd61 to
c679c06
Compare
dkhlapov
marked this pull request as ready for review
October 12, 2026 23:36
… outline; look up only when drawn background_at hit-tests a filled shape's real outline (shape_path), so an ellipse's corner shows what lies beneath. The caret's colour is worked out only when the caret (or IME text) is drawn, and the unused Tokens::caret is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Review follow-ups (d64327e):
Full CI passed. |
# Conflicts: # ROADMAP.md # docs/ui-parity.md
Member
|
Thanks for the contribution, @dkhlapov! This has landed in main. If you haven't already, come join us on Discord: https://discord.gg/artcraft |
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.
#299: the caret contrasts with what lies under it
Fixes #299. The caret is now black or white, whichever contrasts more with what lies under it: the paper, the page colour, a dark page, shading or a highlight. This is similar to Word's inverted caret. Before, it was always black (white only on Switch Modes' dark page), so it disappeared on dark page colours, shading and highlights. The equation caret and IME preedit text use the same rule.
What changed:
wordcraft_render::background_atreturns the on-screen colour behind a page point. It works from the page's draw list, blended in drawing order.canvas::caret_contrastpicks the caret colour. The result is cached per layout, view, page and point, so the blink doesn't rebuild the page.Tests:
render::tests::background_at_caret_follows_page_colour_highlight_and_dark_modecanvas::tests::caret_contrasts_with_what_lies_under_itcargo xtask cipasses.Limitations: pictures behind text and rotated content aren't considered; the caret falls back to the paper colour there. The mouse I-beam is the OS cursor and is unchanged.
🤖 Generated with Claude Code