romainl/Apprentice

Remove special handling for iTerm.app

djmoch opened this issue · 3 comments

Not sure of all of the history here, but I assume the reason iTerm is handled differently from other terminal emulators at all is because of some irregularities in it's 256 colorspace. Whatever the reason, the colors look correct to me if the special handling is removed, otherwise they look a bit too dark.

Tested by running iTerm with this color configuration, opening Vim inside a tmux session, and comparing the background color to the border the tmux places around the terminal panes. The colors are a perfect match if the special-case handling for iTerm is removed.

Current iTerm version for me is Build 3.0.13.

That branching was necessary because iTerm used to expose colors to users/programs in a different colorspace than the one it used internally. This resulted in a shifted palette that was most apparent in flat areas.

That issue was supposed to be fixed someday at iTerm's level but I stopped using it in the mean time so I never really had the occasion to check it out. I suppose they fixed it as part of their new "truecolor" feature.

I'm OK with removing that part. Could you send me a PR?

I've done a bit more looking into this and discovered that iTerm themes have at least two different color spaces to choose from, sRGB and Calibrated. My itermcolors file uses the Calibrated color space, and everything works without the special case handling in Apprentice. If I switch back to the sRGB colorspace, then I do end up needing the special case.

Since default behavior on current iTerm is to use the Calibrated color space, I still think the PR is the right thing to do, but this will break people using an older iTerm. An even better approach might be to introduce a global, g:apprentice_iterm_srgb_color_space, and key off that. Folks using older iTerm would have to set the global, but at least they would have the option. But then part of what I've liked about Apprentice is not having to configure anything, so ... I guess I'm back to where I started.

I'll put together a PR and you can decide what you want to do with it.

But then part of what I've liked about Apprentice is not having to configure anything

And that is very, very, very important for me.