Skip to content

Add theme support for customizable colors#801

Open
FlipFlopszzz wants to merge 1 commit intomicrosoft:mainfrom
FlipFlopszzz:theme
Open

Add theme support for customizable colors#801
FlipFlopszzz wants to merge 1 commit intomicrosoft:mainfrom
FlipFlopszzz:theme

Conversation

@FlipFlopszzz
Copy link
Copy Markdown

Add theme support for customizable colors, format: RGB/RGBA

Example config

{
"theme": {
  "black": "#000000",
  "red": "#FF0000FF",
  "green": "#00FF00",
  "yellow": "#FFFF00FF",
  "blue": "#204DBE",
  "magenta": "#FF00FFFF",
  "cyan": "#00A7B2",
  "white": "#FFFFFFFF",
  "brightBlack": "#808080",
  "brightRed": "#FF3E30FF",
  "brightGreen": "#58EA51",
  "brightYellow": "#FFC944FF",
  "brightBlue": "#2F6AFF",
  "brightMagenta": "#FC74FFFF",
  "brightCyan": "#00E1F0",
  "brightWhite": "#FFFFFFFF",
  "background": "#0C0C0C",
  "foreground": "#00FF00FF",
  "lineNumber": "#FF00FF",
  "lineHighlight": "#00FF00FF"
}
}

Scope

This is a lightweight change with no new dependencies.

The changes are limited to:

  • settings.rs: Theme config parsing and storage
  • documents.rs: Apply theme colors when creating buffers
  • buffer/mod.rs: TextBuffer color setters
  • main.rs: Apply user theme colors to indexed colors array
  • framebuffer.rs: Fix background/foreground color application from indexed colors

Validation

cargo test -q

Notes

  • All theme fields are optional; omitted colors fall back to defaults
  • The theme configuration reuses the existing settings.json
  • Binary size increase 5KB (+1.3%) (measured with cargo build --release)

Only tested on Windows 11 with cargo 1.86.0

Screenshot

ScreenShot_2026-04-16_13-34-18

@FlipFlopszzz
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@lhecker
Copy link
Copy Markdown
Member

lhecker commented Apr 16, 2026

Unfortunately, I'm not sure if we can merge this. My vision was to introduce a CSS-like language for theming of the application. I briefly mention this here:

//! The reason "classnames" are used is because I was hoping to add theming
//! in the future with a syntax similar to CSS (simplified, however).

A while ago I had started a prototype in this branch: https://github.com/microsoft/edit/tree/dev/lhecker/css

@FlipFlopszzz
Copy link
Copy Markdown
Author

I honestly just need a way to customize colors, don't care about the implementation details. Your CSS plan definitely sounds more robust.
If the CSS plan is still a ways off, this PR might help bridge the gap in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants