Skip to content

Conversation

glasswalls13
Copy link

@glasswalls13 glasswalls13 commented Jun 26, 2025

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

@glasswalls13
Copy link
Author

Screenshot 2025-06-26 at 12 19 32 PM

@glasswalls13
Copy link
Author

@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 {
Copy link
Member

@lhecker lhecker Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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").

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.

Add support for Terminal.app on macOS
2 participants