Skip to content

refactor(editor): take canvas theme colors from the theme's CSS - #3088

Merged
bajrangCoder merged 3 commits into
mainfrom
feat/canvas-css-theme
Nov 15, 2026
Merged

bajrangCoder merged 3 commits into
mainfrom
feat/canvas-css-theme

Conversation

@bajrangCoder

Copy link
Copy Markdown
Member
  • The canvas renderer takes a theme's colors (background, text, cursor, selection, active line fill or frame, gutter, line numbers, matching brackets, selection matches) from the theme's own CSS, resolved by canvas-view, so it draws every theme like the DOM editor.
  • Removed the hand-written theme rule parser from canvasOptions.ts; getCanvasTheme now only adds Acode's own scrollbars, the see-through canvas over a picture, the gutter border, and syntax colors for themes without a highlight style.
  • Fixed One Dark's active line number on the canvas, which used the text color instead of the gutter's.
  • Tests check every built-in theme's resolved colors against its config.

canvas-view now resolves a theme's colors from the state's style
modules itself. getCanvasTheme returns a function over that resolved
theme and only adds what the CSS doesn't say: Acode's own scrollbars,
a see-through canvas over a picture, the gutter border, and syntax
colors for themes without a highlight style. The theme's CSS is the
only source for the rest, so the canvas draws a theme like the DOM
editor does.
@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the earlier non-blocking test coverage concern still open.

Summary

The PR lets canvas-view read editor colors from the theme's CSS instead of Acode's hand-written parser.

  • Canvas editors now draw colors from each theme’s CSS.

Reviews (2) · Last reviewed commit: "test(canvas): check which syntax colors ..." · Reviewed by Greptile

Comment thread tests/unit/canvasOptions.test.ts Resolved
A theme whose highlight style and config disagree: tokens take the
highlight style's colors, and the config's are only used without one.
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder bajrangCoder added the CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. label Nov 15, 2026
@github-actions github-actions Bot removed the CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. label Nov 15, 2026
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

Preview Release for this, has been built.

Click here to view that github actions build

@bajrangCoder
bajrangCoder added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 86f52c1 Nov 15, 2026
14 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Nov 15, 2026
@bajrangCoder
bajrangCoder deleted the feat/canvas-css-theme branch November 15, 2026 17:08
@AuDevTist1C AuDevTist1C mentioned this pull request Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant