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

Override formatter colors from envvars #1095

Merged
merged 2 commits into from Dec 14, 2022

Conversation

blacksails
Copy link
Contributor

This allows a user to set environment variables
GINKGO_CLI_COLOR_<color> with asci code overrides. This helps a lot when the colorscheme that you are using doesn't play well with the colors from the 256 color scheme which currently is hard coded.

Example GINKGO_CLI_COLOR_RED=$'\x1b[31m' ginkgo will use the red from the 8bit colors configured in the terminal.

This allows a user to set environment variables
`GINKGO_CLI_COLOR_<color>` with asci code overrides. This helps a lot
when the colorscheme that you are using doesn't play well with the
colors from the 256 color scheme which currently is hard coded.

Example `GINKGO_CLI_COLOR_RED=$'\x1b[31m' ginkgo` will use the red from
the 8bit colors configured in the terminal.
@blacksails
Copy link
Contributor Author

blacksails commented Dec 14, 2022

I dont nessesarily expect this to get merged as-is, but I would love an option to be able to change the colors of the terminal output. I am open to any input with regards to how this could be done differently.

The formatter testsuite currently fails if environment variables are overridden. I guess the before each needs to unset the environment variables to ensure that the tests give the expected results. Fixed in 7b768db

@blacksails blacksails changed the title Override environment formatter colors from envvars Override formatter colors from envvars Dec 14, 2022
@onsi
Copy link
Owner

onsi commented Dec 14, 2022

hey there - longer term my plan is to add support for some sort of .ginkgoconfig file or something that would be a natural place for something like this. For now environment variables seem fine but I'd like to reserve the right to deprecate them at some point and transition to a config file based approached.

Happy to pull this in once CI goes green, with those caveats.

@onsi onsi merged commit 60240d1 into onsi:master Dec 14, 2022
@blacksails
Copy link
Contributor Author

blacksails commented Dec 15, 2022

@onsi Yea this could also be better implemented.

The following values would be nice to map in order to make configuration way easier.

For the standard 16 colors
red => \x1b[31m
1 => \x1b[31m
bright-red => \x1b[31;1m
8 => \x1b[31;1m

For extended 256 colors
16 => \x1b[38;5;16m

@blacksails blacksails deleted the override-formatter-colors-from-envvars branch December 15, 2022 16:37
@onsi
Copy link
Owner

onsi commented Dec 15, 2022

hey, i think that's fine - but perhaps i'm not following? are you planning on another PR to support those aliases?

@blacksails
Copy link
Contributor Author

@onsi yea will do it today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants