-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Allow inverse colors to be stored in glyph keys, fix inverted colors in DOM renderer #1739
Conversation
This uses the actual fg for bg and bg to fg, rather than the black/white theme colors Fixes xtermjs#1738
src/renderer/BaseRenderLayer.ts
Outdated
@@ -298,7 +298,7 @@ export abstract class BaseRenderLayer implements IRenderLayer { | |||
|
|||
if (fg === INVERTED_DEFAULT_COLOR) { | |||
this._ctx.fillStyle = this._colors.background.css; | |||
} else if (fg < 256) { | |||
} else if (fg < DEFAULT_COLOR) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing a range check against what is essentially an enum value is a little confusing. Since we're doing this in a few places, maybe we should have a isNormalColor
helper function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No comments form myside, LGTM.
Fixes #1737
This issue was happening as we were assuming fg was a number >= 0 for the glyph key but it could also be
-1
to indicate an inverse default color. See the first commit for this fix.The second commit cleans up the usage of 256/257 as the fg color by introducing constants. It also removes 257 as the "No BG color key" and instead uses 256 as that is the default color for the background, I don't think there's a reason to differentiate them.
The third commit fixes #1738 (not a regression).
Before
DOM Renderer
Canvas/static
Canvas/dynamic
After
DOM Renderer
Canvas/static
Canvas/dynamic