Skip to content

Instantly share code, notes, and snippets.

@Otann
Created February 13, 2020 18:02
Show Gist options
  • Save Otann/9f9db2a00ddf000c84855047a4f1d15e to your computer and use it in GitHub Desktop.
Save Otann/9f9db2a00ddf000c84855047a4f1d15e to your computer and use it in GitHub Desktop.

Problem

On Mac if you install almost any version of the powerline, your MacOS Terminal.app would try to inprove contrast of text symbol, which is used as the end of the "bullet train":

Screen Shot 2020-02-13 at 6 42 11 PM

This is somewhat documented in this answer on AskDifferent:

Terminal automatically applies a minimum contrast when displaying an ANSI (or extended 256-color table) color on the terminal background color, or when displaying the terminal foreground/text color on an ANSI background color.

You can see it if you enable background transparency:

Screen Shot 2020-02-13 at 6 52 57 PM

Solution

If we explicitly set Terminal's background to match white ANSI color (7) and explicitly set background color for that symbol, then it would be rendered without any contrast modifications:

# The right end of left prompt.
typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='%K{7}\uE0B0%k'  # problematic contrast character

Screen Shot 2020-02-13 at 6 44 31 PM

Notes

Interestingly, this happens only if the background is set to transparent. For instance, if you enable prompt element, the highlight disappears too, because symbol gets a white background from the config:

typeset -g POWERLEVEL9K_PROMPT_CHAR_BACKGROUND=7
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=4

Screen Shot 2020-02-13 at 6 59 05 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment