Fix #30: Add 256 color support for Terminal.app on macOS#526
Fix #30: Add 256 color support for Terminal.app on macOS#526glasswalls13 wants to merge 2 commits intomicrosoft:mainfrom
Conversation
|
@microsoft-github-policy-service agree |
| _ = write!(dst, "\x1b[{typ}8;2;{r};{g};{b}m"); | ||
| } | ||
| ColorMode::Color256 => { | ||
| let index: u8 = if r == g && g == b { |
There was a problem hiding this comment.
I think the grayscale detection is a little brittle. It may be better to convert the 216+24 colors to Oklab and store them in a list here. Then we can search linearly through it and find the closest coordinate and its index.
While writing a 4D matcher I found that Rust is entirely unable to optimize [f32; 4] operations from MOVSS to MOVPS under opt-level=s which is quite disappointing to learn. I suppose I should hurry my custom stdlib collection reimplementation so we can switch back to opt-level=3 sooner rather than later.
Edit: Filed as rust-lang/rust#143242
All that aside, I would prefer if the entire code is only compiled under cfg(target_platform = "macos").

Added 256 color support for the current version of apple terminal that doesn't support truecolor. For now, I only added support for terminal.app, since as discussed in #30, apple's terminal is likely the only modern terminal that doesn't support truecolor.
I understand apple is adding support for truecolor in MacOS Tahoe, but it will likely be quite some time before most mac users update, and and I'd like to enjoy edit right now without updating to the beta OS.
Fixes #30