-
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
OSC 4/10/11/12 color handling #3524
Merged
Merged
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
6a6043d
properly parse xcolor names
jerch 0f4d71b
make linter happy
jerch 8e71cec
remove only from tests
jerch 01a7322
OSC 10/11 working, OSC 4 partially fixed
jerch 258178f
cleanup & docs for OSC 10/11
jerch 9eb72ee
report 16 bit color spec for query
jerch 5478dd2
Merge branch 'master' into osc_colors
jerch 0871ace
create minified color names module
jerch 9d95c8c
Merge branch 'master' into osc_colors
jerch b7560be
remove named colors
jerch 1c5f24a
Merge branch 'master' into osc_colors
jerch 5437571
simplify color events
jerch 064f683
make linter happy
jerch 56f0e69
api tests for OSC 10 & 11
jerch b55ee77
fix inputhandler type definition
jerch 54822af
use xcolor parser for OSC 4
jerch b8097f5
OSC 4 integration tests
jerch 855ed63
remove only from tests
jerch 4be063b
Merge branch 'master' into osc_colors
jerch 896f5a7
extend logic to OSC 12 cursor color
jerch e62e82b
Merge branch 'master' into osc_colors
jerch 9964210
implement OSC 104|110|111|112
jerch 8432562
cleanup
jerch 0c20589
remove temp atlas fix
jerch 3cc9994
Merge remote-tracking branch 'upstream/master' into pr/jerch/3524
Tyriar e635b3d
Merge remote-tracking branch 'upstream/master' into pr/jerch/3524
Tyriar 086ca58
Comment tweaks
Tyriar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
*/ | ||
|
||
import { IColor } from 'browser/Types'; | ||
import { IColorRGB } from 'common/Types'; | ||
|
||
// FIXME: Move Color.ts lib to common? | ||
|
||
/** | ||
* Helper functions where the source type is "channels" (individual color channels as numbers). | ||
|
@@ -17,6 +20,8 @@ export namespace channels { | |
} | ||
|
||
export function toRgba(r: number, g: number, b: number, a: number = 0xFF): number { | ||
// Note: The aggregated number is RGBA32 (BE), thus needs to be converted to ABGR32 | ||
// on LE systems, before it can be used for direct 32-bit buffer writes. | ||
// >>> 0 forces an unsigned int | ||
return (r << 24 | g << 16 | b << 8 | a) >>> 0; | ||
} | ||
|
@@ -81,6 +86,10 @@ export namespace color { | |
rgba: channels.toRgba(r, g, b, a) | ||
}; | ||
} | ||
|
||
export function toColorRGB(color: IColor): IColorRGB { | ||
return [(color.rgba >> 24) & 0xFF, (color.rgba >> 16) & 0xFF, (color.rgba >> 8) & 0xFF]; | ||
} | ||
} | ||
|
||
/** | ||
|
@@ -197,6 +206,7 @@ export namespace rgba { | |
return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0; | ||
} | ||
|
||
// FIXME: Move this to channels NS? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The namespace was meant to represent the source, so |
||
export function toChannels(value: number): [number, number, number, number] { | ||
return [(value >> 24) & 0xFF, (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF]; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Color.ts lives in browser historically as it's only required when a renderer is active, things have changed a little with this PR where InputHandler knows more about color. Sounds like a good change if
XParseColor
ends up using these utils, but if not it would be best to keep in browser as then it's not included unnecessarily inxterm-headless
.