Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Allow custom color scheme #590

balinterdi opened this Issue · 16 comments

9 participants


It should be possible to override the default color scheme defined in lib/reporters/base.js

The comment for the color function says this is possible:

 * Color `str` with the given `type`,
 * allowing colors to be disabled,
 * as well as user-defined color
 * schemes.

var color = exports.color = function(type, str) {
  if (!exports.useColors) return str;
  return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';

, but I haven't found a way to override the default colors (The types that are displayed in 90 are invisible on the Solarized Dark terminal theme).

tj commented

yeah it's not actually easy right now especially using mocha(1)


I too am having this issue, wrt the Solarized color scheme. For now I just turn colors off using -C


I'm also using the Solarized color scheme and got bitten by this issue. Doing the same thing to turn off colors with -C for now. Is there anything I can do to help get this resolved quicker?

tj commented

tweak them so they're not invisible? :p it doesn't really make sense for any theme to show any of them as invisible that's asking for trouble

@tj tj closed this

Seriously? I practically asked if I could fix it for you. I'm still digging into where exactly the theme is conflicting with Mocha's color commands, but given the fact that Solarized works with virtually every other command line utility I've run, I'm afraid that changing a setting with the theme would mess things up elsewhere.

I understand that it's not high priority, but it would be nice if there were a solution other than dismissing the issue as user error.


The theme isn't making it "invisible", the theme calculates a color that goes well with the theme from the original color. It just so happens that in this case, the color is very close to what the background is. There are many themes that do this, so it isn't uncommon. While it may not be a very high priority, I think it will be useful to allow overriding of colors (or other settings) using some sort of default override (similar to .noserc for python).

tj commented

Overriding would be nice, it's an endless battle otherwise unless we just go with defaults for everything. I've seen this issue with component(1) and the person was using this Solarized theme and it was displaying gray as invisible, that's not my fault

tj commented

see: componentjs/component#182
that's a theme error, you're either tweaking the theme, or you're tweaking everything that uses those escape codes


Thanks for the update. I'll tweak my contrast settings. Would a settings override file be something you would pull?

tj commented

maybe we'd be better off making some note of theme issues, not sure, I'm surprised this sort of thing isn't more common but I do use cyan and gray a lot so I kinda see how it's usually my stuff


The issue I'm having with mocha's color scheme isn't cyan<>gray, but "Bright Black" on "Background".

iTerm2's default dark:

Tomorrow Night:

 e84jpla6 j


Solarized just happens to make 'Bright Black' the same as the background color, so it's out-and-out invisible. If it's really a theme issue, it's a common one for dark themes.


One could argue the popularity statistics of the Solarized theme. My analysis would suggest that this theme is popular and has a lot of support and followers:

screen shot 2014-01-10 at 8 19 07 am

Regardless, one of the quickest ways to piss off other developers is to force your personal preferences on them. Difficulty set aside I think the real issue is that if anyone were to make a Pull Request with the ability to customize colors would it even make it into the repository?

I'd also like to point out that you chose your terminal colors based on what you liked. If I reflect that back and offer a hypothetical: you make a Pull Request or issue to someone else's repository to help better support the colors you like and they flat out told you "No, your fault for picking those colors," how would you feel?

:+1: for entertaining customizing colors so themes like Solarized work.


I've come to expect that people use either black terminals or white terminals, and I as a developer can use any colors in between.

Is there any way to get a default background color? If there is, it can be fixed this way, otherwise it really seem like a theme issue.


#802 has the perfect fix for Mac on iTerm2 with solarized theme. Set the contrast up and all works perfect.


I can specify my git colors in ~/.gitconfig. Would be nice if there were something like that for Mocha.


Whether it's a terminal theme issue or not, it would be nice to have colors overridable. In mocha.opts perhaps ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.