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

Customize console output color? #582

Closed
AdamMc331 opened this issue Sep 16, 2019 · 4 comments
Closed

Customize console output color? #582

AdamMc331 opened this issue Sep 16, 2019 · 4 comments

Comments

@AdamMc331
Copy link
Contributor

AdamMc331 commented Sep 16, 2019

I was looking at the console logs of one of my builds recently that had KtLint errors, and at first they didn't stand out to me. I have the color option on, but noticed that when we color things, they're gray by default: https://github.com/pinterest/ktlint/blob/master/ktlint-reporter-plain/src/main/kotlin/com/pinterest/ktlint/reporter/plain/PlainReporter.kt#L56

Against a black console, this doesn't really stand out to me. Other code quality tools like Detekt will output these using a sharper color like yellow.

I'm curious if we could change the color to something that stands out a little more against a dark console, or if the output color is something that could be customized?

An example of how hard this was to read:

Screen Shot 2019-09-16 at 9 35 05 AM

Comparison to Detekt:

Screen Shot 2019-09-16 at 9 35 22 AM

@AdamMc331 AdamMc331 changed the title gray color Customize console output color? Sep 16, 2019
@AdamMc331 AdamMc331 reopened this Sep 16, 2019
@shashachu
Copy link
Contributor

Well it wouldn't be very plain then, would it? :)

I don't have strong feelings about this either way - you could easily write another custom reporter with nice colors, or this could be customizable...maybe by passing a color to the --color flag? e.g. ktlint --color="(255, 0, 0)" or something

@AdamMc331
Copy link
Contributor Author

AdamMc331 commented Sep 17, 2019

I like that idea! I notice we already have a bunch of colors defined here: https://github.com/pinterest/ktlint/blob/master/ktlint-reporter-plain/src/main/kotlin/com/pinterest/ktlint/reporter/plain/internal/Color.kt

Ideally I could reference these, and maybe we can do --color="RED" and parse the color from that name. If no name is supplied, it could just default to the DARK_GRAY we already use.

I don't know much about how KtLint works now and it may take me a while to figure out how to implement this but I will try. If anyone sees this and knows a quick way to the solution feel free to take it from me. :)

AdamMc331 added a commit to AdamMc331/ktlint that referenced this issue Sep 17, 2019
… have a color injected rather than define one itself.
AdamMc331 added a commit to AdamMc331/ktlint that referenced this issue Sep 17, 2019
…is was easiest without causing a breaking change around color for pinterest#582.
AdamMc331 added a commit to AdamMc331/ktlint that referenced this issue Sep 17, 2019
AdamMc331 added a commit to AdamMc331/ktlint that referenced this issue Sep 17, 2019
AdamMc331 added a commit to AdamMc331/ktlint that referenced this issue Sep 17, 2019
AdamMc331 added a commit to AdamMc331/ktlint that referenced this issue Sep 17, 2019
@AdamMc331
Copy link
Contributor Author

Here's my take on that: #585

AdamMc331 added a commit to AdamMc331/ktlint that referenced this issue Sep 19, 2019
AdamMc331 added a commit to AdamMc331/ktlint that referenced this issue Sep 30, 2019
Tapchicoma pushed a commit that referenced this issue Oct 1, 2019
* Added support for customizing the output color for #582.

* Fixed test compilation.
@Tapchicoma
Copy link
Collaborator

Closed via #585

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

No branches or pull requests

3 participants