-
Notifications
You must be signed in to change notification settings - Fork 585
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
Colorize severity in table output #225
Comments
Hey @sprt, this sounds cool! This is certainly something we're open to. Our main considerations are that the colors are a) helpful (like you mention) and b) easily readable, even on a variety of terminal configurations (e.g. some folks prefer dark backgrounds, some prefer light backgrounds, etc.). As for colors themselves, I think we'll have to see how it looks in context, but I'm sure this won't be a hard problem. One idea is to be consistent with our grype VS Code extension, specifically the "vulnerability report" view (whose code is here: https://github.com/anchore/grype-vscode/blob/main/src/ui/react-components/FindingsList.tsx#L148-L162). If you want to take a stab at this, that'd be very helpful! I'd be more than happy to serve as a resource and walk through how we've designed the output mechanism. |
Regarding ((display each severity label in its own color in the table output.)) : |
- Create flag "--no-color" to allow disabling the color. By default its enabled. - When "--no-color" not specified highlight severity in its color: - Critical -> Bold Red - High -> Red - Medium -> Yellow - Low -> Green - Negligible -> Blue - Note: Golang doesn't have all colors available. Also, doesn't seem to be able use hex codes properly. Closes anchore#225 Signed-off-by: Shane Dell <shanedell100@gmail.com>
- Create flag "--no-color" to allow disabling the color. By default its enabled. - When "--no-color" not specified highlight severity in its color: - Critical -> Bold Red - High -> Red - Medium -> Yellow - Low -> Green - Negligible -> Blue - Note: Golang doesn't have all colors available. Also, doesn't seem to be able use hex codes properly. Closes anchore#225 Signed-off-by: Shane Dell <shanedell100@gmail.com>
- Create flag "--no-color" to allow disabling the color. By default its enabled. - When "--no-color" not specified highlight severity in its color: - Critical -> Bold Red - High -> Red - Medium -> Yellow - Low -> Green - Negligible -> Blue - Note: Golang doesn't have all colors available. Also, doesn't seem to be able use hex codes properly. - Add termenv to check if the terminal color profile supports colored output. If it doesn't default to noColor Closes anchore#225 Signed-off-by: Shane Dell <shanedell100@gmail.com>
The PR has been updated to respond to the |
* Colorize severity in table output - Create flag "--no-color" to allow disabling the color. By default its enabled. - When "--no-color" not specified highlight severity in its color: - Critical -> Bold Red - High -> Red - Medium -> Yellow - Low -> Green - Negligible -> Blue - Note: Golang doesn't have all colors available. Also, doesn't seem to be able use hex codes properly. - Add termenv to check if the terminal color profile supports colored output. If it doesn't default to noColor Closes #225 Signed-off-by: Shane Dell <shanedell100@gmail.com> * fix: adopt EnvColorProfile to support NO_COLOR Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> * fix linting and update snapshots Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Shane Dell <shanedell100@gmail.com> Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Christopher Phillips <christopher.phillips@anchore.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
It would be nice to display each severity label in its own color in the table output. Trivy does that well and it makes visually parsing the output just a little bit faster, with just a quick glance. I'd suggest something like low = blue, medium = yellow, high = red, critical = bold red. Happy to contribute a PR if you think this sounds interesting!
The text was updated successfully, but these errors were encountered: