Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support foreground and background colors that differ from the color palette #57

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

JohnSchmeichel
Copy link
Contributor

@JohnSchmeichel JohnSchmeichel commented Mar 25, 2023

Color schemes like PowerShell and Vintage have background and foreground colors that are different from ConsoleColor.Black and ConsoleColor.Gray colors, respectively. Code assuming these colors match the palette results in the wrong color being used during rendering. For navigation (especially when scrolling up or down) this can cause tearing as the correct background is used to clear the screen, then the incorrect color from the palette is used to render the line.

This change uses nullable ConsoleColor throughout the view and line renderers, where null implies reset the background or foreground color, and an explicit ConsoleColor.Black or ConsoleColor.Gray is used to use that color palette index. Also switched the Vt100 code to use the color palette index instead of the hard-coded RGB values. Full theme customization as described in #50 is a much larger change, and supporting the users color palette in that system would still be desirable. The added benefit is that if the color palette changes the app doesn't need to be restarted to pick up the change.

Before:
image

After:
image

@terrajobst
Copy link
Owner

That's awesome! :-)

@terrajobst terrajobst merged commit 71d0ad4 into terrajobst:main Feb 6, 2024
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