licence_audit/color

Types

pub type ColorModeError {
  InvalidColorValue(String)
}

Constructors

  • InvalidColorValue(String)
pub type DependencySection {
  ProductionDependencies
  DevelopmentDependencies
}

Constructors

  • ProductionDependencies
  • DevelopmentDependencies
pub type Mode {
  Auto
  Always
  Never
}

Constructors

  • Auto
  • Always
  • Never
pub type Palette {
  Palette(enabled: Bool)
}

Constructors

  • Palette(enabled: Bool)

Values

pub fn bold(palette: Palette, text: String) -> String

Render text in bold when color is enabled; plain text otherwise.

pub fn bold_underline(palette: Palette, text: String) -> String

Render text in bold and underlined when color is enabled; plain text otherwise.

pub fn boxed(
  palette: Palette,
  title: String,
  content: String,
) -> String

Frame content in a rounded box with a title in the top border. The box borders are drawn (uncolored) even when the palette is disabled, so callers get a consistent layout regardless of color support.

pub fn dependency_section_title(
  palette: Palette,
  section: DependencySection,
) -> String

Render a dependency section title with scope-aware emphasis.

pub fn dim(palette: Palette, text: String) -> String

Render text dimmed when color is enabled; plain text otherwise.

pub fn for_enabled(enabled: Bool) -> Palette
pub fn green(palette: Palette, text: String) -> String
pub fn mode_error_message(error: ColorModeError) -> String

Human-readable description of an invalid --color value.

pub fn mode_from_string(
  value: String,
) -> Result(Mode, ColorModeError)
pub fn red(palette: Palette, text: String) -> String
pub fn resolve(mode: Mode) -> Palette
pub fn resolve_with_color_level(
  mode: Mode,
  level: tty.ColorLevel,
) -> Palette
pub fn severity(palette: Palette, label: osv.Severity) -> String

Render a fixed-width, color-coded severity tag suitable for the vulns report. Width is constant (10 chars) regardless of color so columns align with or without ANSI codes.

pub fn yellow(palette: Palette, text: String) -> String
✨ Search Document