39

While it's great that Terminal now has built-in support for changing the ANSI colors, I find it annoying that it automatically adjusts the colors to improve contrast, which means the colors that I actually pick often end up washed out or off in some other way. Here's a screenshot explaining the problem:

screenshot of OS X Terminal.app color settings

This bugs me because I like to use the same color scheme in Terminal and MacVim, and with this handling of colors by Terminal, they don't match up to the ones in MacVim.

Does anyone know of a solution to this, besides switching to iTerm 2 (which I'd rather not – I like the rest of Terminal, especially some GUI touches like the pulsating visual bell). Thanks!

5
  • 1
    Good question – adjustments also seem to be made for window transparency, never mind sub pixel rendering…
    – kopischke
    Oct 28, 2011 at 9:25
  • @kopischke, the minimum-contrast adjustment does not take into account the background color opacity, if that's what you mean.
    – Chris Page
    Nov 8, 2011 at 9:14
  • It would help if you posted a screenshot showing the expected colors on a black background. Numbers aside, I can't really see a difference between the color swatches in the preferences window and the text colors in the terminal in your screenshot, so it's hard to tell how significant the difference is.
    – Chris Page
    Nov 8, 2011 at 9:15
  • 1
    Now I know why I despise OS X. I've lost 6+ hours trying to find out why a color scheme I designed on Linux was mangled on my friend's Mac - I suspected problems with color space conversion (sRGB vs Apple RGB), but I would never guess that it was terminal's fault... Thanks for confirming my diagnosis. Feb 21, 2016 at 19:53
  • Off-topic, but iTerm2 lets you have a puslating visual bell. Prefs > Advanced > Visual bell flashes whole screen, not just a bell icon.
    – user2551
    Feb 2, 2019 at 4:37

5 Answers 5

25
+50

Here's the trick that you need to know: Values set via RGB get mangled, those set via HSB do not.

I had a similar problem using the (great) Solarized color scheme: MacVim had a darker (and correct) background color than Terminal, even though I was setting all of the correct RGB values per the Solarized spec. See here:

Basically you need to know what your color values are supposed to be for each of the Terminal ANSI, text, and Background (note this one is on the Window tab) colors and then set them via the HSB picker instead of RGB. See this example:

For whatever reason (I suspect some type of profile thing, or perhaps a contrast tweak as you suggest), the RGB color you enter is not what you get. You'll also notice that once you've set the values via HSB, switching to the RGB picker will show options different than you'd expect. The Solarized value conversions all agree according to Photoshop; it seems to be something that the Apple color picker is doing for you.

9
  • 11
    This is an unbelievably good answer. Mar 14, 2012 at 16:52
  • Looks like RGB isn't mangled as such, just modified by the pickers opacity settings as per the answer by @eirnym - combination of the 2 not only explains it, but solves it in 2 ways. Great!
    – stuffe
    Mar 17, 2012 at 0:07
  • 2
    Not to rain on the parade, but I can’t confirm this fixes the issue – Terminal.app keeps modifying values I input in HSB color space, even when setting the background to the correct values (including opacity 100 % and blur 0 %) first. Bright values seem to be less prone to this, the non-bright more so. Maybe the color picker in Terminal.app is seriously buggy, maybe it tries to be “smart” about contrast and color range (I wouldn’t put either past Apple) – be it as it may, the solution above does not work on my system.
    – kopischke
    Mar 31, 2012 at 23:05
  • … investigating some more, the issue seems to be rooted in the mapping of Solarized colors from device independent (LAB / HSB color space) to device dependent color space (RGB). Consistent results can be achieved when selecting HSB color space, as shown above, but only when also expressly mapping to device RGB (in the drop down menu behind the tiny arrow on the small color square left of the color space dropdown). Differences in the RGB values to the Solarized color tables are explained by the fact Solarized maps to sRGB, while the color picker always implicitly maps to device RGB.
    – kopischke
    Mar 31, 2012 at 23:45
  • … which goes to tell the OS X color picker has been designed for people who actually know what this color space stuff is about (i.e. graphic designers), not us Terminal grunts :). [yeah, OT, I know]
    – kopischke
    Mar 31, 2012 at 23:46
11

choosing 'Device RGB' from the Apple Color Picker swatch dropdown

  1. Open the color picker
  2. Choose the sliders tab
  3. Click on the swatch below the magnifying glass, to the left of the slider dropdown
  4. Choose Device RGB

Now colors specified by hex value will not be subjected to color space conversion.

In Sierra, the color space picker has changed to the gear icon: Sierra color space picker

Source

3
  • 2
    Cool - thanks for this! For all of Apple's design prowess, it is totally non-obvious that clicking on this would reveal a menu. Apr 22, 2012 at 12:39
  • Note: if this workaround of using colors with different color spaces works, it's likely relying upon a bug in the color-handling code, which is supposed to work with any color, and may stop working in the future when that bug is fixed.
    – Chris Page
    Nov 17, 2015 at 22:32
  • 1
    This trick worked for me; the HSB trick did not.
    – Jay
    Aug 19, 2019 at 13:09
5

Color profiles are definitely important, but there's another issue lurking here: Terminal.app automatically brightens any color when displayed over the default background. Here, for example, are the colors output by Terminal.app running the Solarized color theme, as measured with DigitalColor Meter in sRGB mode, and compared against the canonical Solarized sRGB values.

When presented over a black (or any other color) background, Terminal.app produces approximately the correct colors; however, on the default background, all colors except the default and default bold text are substantially too bright.

a color test in Terminal.app. Colors are as expected when presented over colored backgrounds, but brightened when presented over the default background.

2
  • Down-voted because this isn't an answer. It seems to be a comment about the question.
    – Chris Page
    Nov 17, 2015 at 22:31
  • 4
    How did you generate that color table? Looks super handy.
    – Luke Davis
    Jun 4, 2018 at 0:03
5

In short: no, there's no supported means to disable this.

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.

This is meant to be a convenience, so that one can set a background or foreground color and have them contrast with the ANSI colors without having to adjust all the ANSI colors. This was especially important in earlier versions of Terminal, which lacked Preferences support for customizing the ANSI colors.

Older versions of Terminal applied the minimum-contrast for all color combinations, but that meant that, e.g., ANSI red-on-red text could be readable, but some programs intentionally display text with the same foreground and background color in order to hide it (for displaying game hints or joke punchlines, for example). Because of that, newer versions of Terminal do not apply the minimum-contrast when displaying one ANSI color upon another.

Now, rather than just address the same-color case, Terminal avoids applying the minimum-contrast for all combinations of ANSI colors, because it is assumed that if the user customizes any ANSI colors they will customize them all to contrast with each other as desired. It is also assumed that those users will adjust or take into account the terminal background and foreground colors to fit their desired color scheme.

If the workaround of using colors with different color spaces—suggested in other answer(s)—works, it's likely relying upon a bug in the color-handling code, which is supposed to work with any color, and may stop working in the future when that bug is fixed.

If being able to explicitly disable or adjust the minimum-contrast behavior is important to you, I recommend letting Apple know by filing a report at https://developer.apple.com/bug-reporting/ using any Apple ID.

2

Open Window settings for your theme, toggle background color, set blur to 0% and Opacity to 100%. After this your colors will be same as you want. Also you should check every color you pick for text for this parameters.

enter image description here

1
  • Down-voted because this doesn't apply to the question, which is about Terminal's minimum-contrast behavior and is unaffected by the background opacity.
    – Chris Page
    Nov 17, 2015 at 22:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .