Skip to content
internal/render
Edit
On this page

Colored terminal output: the summary block, combined and split format tables, width adaptation and cell truncation, the legend, and error formatting.

#internal/render

#internal/render

Package render produces the colored terminal output: summary section, format tables, legend, and the extensionless-file list.

#Options

Go go
type Options struct

Options controls table rendering. All fields are presentation-only and never affect JSON output.

#FormatError

Go go
func FormatError(colored bool, theme config.Theme, format string, args ...interface{}) string

FormatError renders one stderr error line: "error: \n". When colored is true (stderr is a TTY and --colors is true), the "error:" prefix carries the theme's error color (R30); otherwise the result is plain text, byte-identical to non-TTY output.

#DetectThemeName

Go go
func DetectThemeName() string

DetectThemeName picks "dark" or "light" from the COLORFGBG environment variable ("fg;bg"). Backgrounds 7, 15, and 9-14 indicate a light terminal; anything else (or no clear signal) defaults to dark.

#Render

Go go
func Render(w io.Writer, res *scan.Result, opts Options)

Render writes the full table-mode output for a scan result.

Search