alacritty: Dim colors are incorrectly computed for light background


OS: Linux Version: 0.5.0, 0.6.0-dev (56c6ff18) Linux/BSD: X11, i3

I’m using a light background and noticed that text with the dim attribute is not rendered correctly. The text is displayed with more instead of less intensity.

For example, using the script from libvte yields the following first few lines on a dark background in alacritty:


Note that the dim and bold+dim lines are less intense.

On a light background, the following is shown:


The dim and bold+dim lines are displayed in a darker color than the normal lines, which makes the text more intense, contrary to what the dim attribute means on dark background.

I think this is incorrect, the text should be displayed in a lighter color on light background. For the record, libvte does the same (and I think that’s a bug there, too).

In contrast to Xterm.js, which is embedded in Visual Studio Code correctly renders dim colors (in my opinion):


You can see that the text is rendered in a lighter color.

I dug into the code and saw that the dim colors are computed by multiplying each color with a factor of 0.66, thereby making it darker. I implemented a proper algorithm which takes the background color into account (using the same idea as Xterm.js, blend the background and the color with a 50% opacity). You can find it in the branch fix-dim-light-background in my fork, the commit is here:

Implementing the algorithm wasn’t that hard, but I didn’t manage to get the background color in all places where the dim colors are calculated.

Can somebody please help? Is this something you’re willing to merge? You can just take my commit and fix the other places, that’d be great! Or just guide me a bit so I can fix them…

Thanks a lot for all your work on a memory-safe terminal emulator!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 25 (14 by maintainers)

Most upvoted comments

So how can we make the text show the in same “lighter” way when there’s a light background, as in the Xterm.js example provided earlier?

Define those

Clearly the result is not what one expects and what is visually proper. You may think what you want about that, and choose not to fix it of course. Nothing I can do about it. Regardless, the images speak for themselves. Thanks.

It depends what are you expecting from dim, less contrast or darker. If we think from a point of brigher, normal, and dim, then it feels like the answer is darker.

Also, just fyi, if you don’t like default dim colors you can change them.

The color factor is less intense and it is dimmed regardless of the background color. I don’t see how this would be incorrect?

I’m not sure we’re talking about the same thing.

Let’s say we have white text on dark background. Dimming the white text by scaling it with a factor 0.66 would lead to a light grey text, which on a dark background looks less intense (“dimmed” or “faint” as the standard describes it).

If the text is black and the background is white, dimming the text color by scaling it with a factor of 0.66 does not change the color at all because #000000 * 0.66 is still #000000. So users cannot even see a difference between “dim” and “normal” text.

I think that’s a bug, do you disagree? 😃