opencode
opencode copied to clipboard
feat(tui): highlight hex codes with the color
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
https://github.com/user-attachments/assets/dfc4aac9-1d11-492c-bfe8-ddb8776ee3e9