Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow custom color scheme #590

Closed
balinterdi opened this Issue · 16 comments

9 participants

@balinterdi

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
Owner
tj commented

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

@devdazed

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

@brendanberg

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
Owner
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
@brendanberg

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.

@devdazed

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
Owner
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
Owner
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

@devdazed

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

@tj
Owner
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

@mattly

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

iTerm2's default dark:
n_ott0dai_oa

Tomorrow Night:
9kbvqftahyc1

Molokai:
 e84jpla6 j

Twilight:
usvhu8d6fgrp

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.

@sukima

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.

@rlidwka

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.

@sukima

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

@katylava

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

@rashad612

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.