Skip to content

Conversation

@eschcam
Copy link

@eschcam eschcam commented Nov 11, 2025

Description

Added a --no-color flag that removes all colour from logs and tables in terminal output

Related issues

@github-actions github-actions bot added the apidiff Indicates Go API changes relevant to library consumers (CLI compatibility may be unaffected) label Nov 11, 2025
@github-actions
Copy link

github-actions bot commented Nov 11, 2025

📊 API Changes Detected

Semver impact: major

github.com/aquasecurity/trivy/pkg/k8s/report
  Compatible changes:
  - Option.NoColor: added

github.com/aquasecurity/trivy/pkg/report/table
  Incompatible changes:
  - NewFileLicenseRenderer: changed from func(*bytes.Buffer, bool, []github.com/aquasecurity/trivy-db/pkg/types.Severity) *fileLicenseRenderer to func(*bytes.Buffer, bool, bool, []github.com/aquasecurity/trivy-db/pkg/types.Severity) *fileLicenseRenderer
  - NewMisconfigRenderer: changed from func(*bytes.Buffer, []github.com/aquasecurity/trivy-db/pkg/types.Severity, bool, bool, bool, []github.com/aquasecurity/trivy/pkg/fanal/types.ConfigType) *misconfigRenderer to func(*bytes.Buffer, []github.com/aquasecurity/trivy-db/pkg/types.Severity, bool, bool, bool, bool, []github.com/aquasecurity/trivy/pkg/fanal/types.ConfigType) *misconfigRenderer
  - NewPkgLicenseRenderer: changed from func(*bytes.Buffer, bool, []github.com/aquasecurity/trivy-db/pkg/types.Severity) *pkgLicenseRenderer to func(*bytes.Buffer, bool, bool, []github.com/aquasecurity/trivy-db/pkg/types.Severity) *pkgLicenseRenderer
  - NewSecretRenderer: changed from func(*bytes.Buffer, bool, []github.com/aquasecurity/trivy-db/pkg/types.Severity) *secretRenderer to func(*bytes.Buffer, bool, bool, []github.com/aquasecurity/trivy-db/pkg/types.Severity) *secretRenderer
  - NewSummaryRenderer: changed from func(*bytes.Buffer, bool, github.com/aquasecurity/trivy/pkg/types.Scanners) *summaryRenderer to func(*bytes.Buffer, bool, bool, github.com/aquasecurity/trivy/pkg/types.Scanners) *summaryRenderer
  - NewVulnerabilityRenderer: changed from func(*bytes.Buffer, bool, bool, bool, []github.com/aquasecurity/trivy-db/pkg/types.Severity) *vulnerabilityRenderer to func(*bytes.Buffer, bool, bool, bool, bool, []github.com/aquasecurity/trivy-db/pkg/types.Severity) *vulnerabilityRenderer
  - RenderTarget: changed from func(io.Writer, string, bool) to func(io.Writer, string, bool, bool)
  Compatible changes:
  - Options.NoColor: added

github.com/aquasecurity/trivy/pkg/flag
  Compatible changes:
  - GlobalFlagGroup.NoColor: added
  - GlobalOptions.NoColor: added
  - NoColorFlag: added
  - Options.NoColor: added

github.com/aquasecurity/trivy/pkg/log
  Incompatible changes:
  - InitLogger: changed from func(bool, bool) to func(bool, bool, bool)
  Compatible changes:
  - Options.NoColor: added

@aqua-bot aqua-bot requested a review from a team November 11, 2025 10:55
@knqyf263
Copy link
Collaborator

As commented here, --color=always|never|auto or --color=true|false|auto looks better to me. Also, a color library Trivy uses respects NO_COLOR. The problem seems that https://github.com/alecthomas/chroma doesn't respect NO_COLOR.

@eschcam
Copy link
Author

eschcam commented Nov 17, 2025

As commented here, --color=always|never|auto or --color=true|false|auto looks better to me. Also, a color library Trivy uses respects NO_COLOR. The problem seems that https://github.com/alecthomas/chroma doesn't respect NO_COLOR.

--no-color makes the most sense to me as you either want the default output or the output with colour removed.
I have no idea what auto would do in the version you suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apidiff Indicates Go API changes relevant to library consumers (CLI compatibility may be unaffected)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--no-color option

2 participants