Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom color scheme #590

Closed
balinterdi opened this issue Sep 25, 2012 · 25 comments
Closed

Allow custom color scheme #590

balinterdi opened this issue Sep 25, 2012 · 25 comments

Comments

@balinterdi
Copy link

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
Copy link
Contributor

tj commented Sep 25, 2012

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

@devdazed
Copy link
Contributor

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

@brendanberg
Copy link

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
Copy link
Contributor

tj commented Dec 15, 2012

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 as completed Dec 15, 2012
@brendanberg
Copy link

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
Copy link
Contributor

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
Copy link
Contributor

tj commented Jan 1, 2013

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
Copy link
Contributor

tj commented Jan 1, 2013

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
Copy link
Contributor

devdazed commented Jan 2, 2013

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

@tj
Copy link
Contributor

tj commented Jan 2, 2013

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
Copy link

mattly commented Jan 25, 2013

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
Copy link
Contributor

sukima commented Jan 10, 2014

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?

👍 for entertaining customizing colors so themes like Solarized work.

@rlidwka
Copy link

rlidwka commented Jan 11, 2014

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
Copy link
Contributor

sukima commented Jan 23, 2014

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

@katylava
Copy link

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

@rashad612
Copy link

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

@ekkis
Copy link

ekkis commented Dec 1, 2015

+1. on my black terminal I find the specific shade of red used for errors very hard to read and would like to be able to change it

@ekkis
Copy link

ekkis commented Dec 1, 2015

incidentally, I changed the colour choices in lib/reporters/base.js but it didn't have any effect on the output so maybe there's some other location where this can be changed

@ekkis
Copy link

ekkis commented Dec 1, 2015

it's a pity to have to turn colours off but how would I do it? my tests are run from a Gruntfile.js via mocha-phantomjs and I have an entry like this:

grunt.initConfig({
  mochaTest: {
    mocha_phantomjs: {
    all: ['tests/browser/*.html']
    }

@boneskull
Copy link
Contributor

@ekkis that's a question for whatever grunt plugin you're using, but the option in mocha is --no-colors

@ghost
Copy link

ghost commented Jan 21, 2016

Still not fixed? I can't see mine at all, it's all black on black. :(

@nichtich
Copy link

nichtich commented Aug 2, 2016

Several solutions for solarized have been proposed in #802 but rejected as "not my problem" by mocha developers. Support of customizing colors with a config file would not change the default but allow users to decide.

@boneskull
Copy link
Contributor

We could expend resources adding custom color support, OR the users with this problem could modify their terminal, which likely already has custom color support.

@brendanberg
Copy link

Solarized is a very common terminal theme and I'm sure this problem affects more than just the people on this thread.

The "not my problem" attitude alienates a community that wants to help out with maintenance and improvements. A little empathy goes a long way.

@boneskull
Copy link
Contributor

The "not my problem" attitude alienates a community that wants to help out with maintenance and improvements. A little empathy goes a long way.

I can't begin to tell you how profoundly mistaken you are. So I won't; instead, I'll lock this issue so I don't forget I shouldn't.

@mochajs mochajs locked and limited conversation to collaborators Aug 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests