Skip to content

Conversation

@jettptacek
Copy link

@jettptacek jettptacek commented Jan 17, 2026

What does this PR do?

Highlights hex color codes in markdown content with their actual color as the background. The foreground text automatically switches between black and white based on luminance for readability.
Supports:

  • 3-char (#rgb)
  • 4-char (#rgba)
  • 6-char (#rrggbb)
  • 8-char with alpha (#rrggbbaa)
    Colors with alpha are blended against the theme background, and update correctly when switching themes.

Closes #2586

How did you verify your code works?

Manual verification in Wezterm and Powershell on Windows

opencode_colorcode.mp4

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@jettptacek
Copy link
Author

This feature probably benefits from being configurable. I don't know if that is what people want tho. I could see this being part of a set of non-theme colorization options that users could set what they want

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.

feat: highlight hex codes with the color

1 participant