HelpColorScheme class Core

Color scheme for command help output.

Provides customizable colors for different parts of help text:

  • headings (e.g., "Description:", "Usage:")
  • commands (e.g., serve, build)
  • options (e.g., --port, -p)
  • descriptions
  • error messages

Uses AdaptiveColor so colors automatically adapt to:

  • Terminal color capabilities (ANSI vs truecolor)
  • Light/dark terminal backgrounds

Usage

// Use a preset
runner.helpColorScheme = HelpColorScheme.dark();

// Or customize
runner.helpColorScheme = HelpColorScheme(
  heading: AdaptiveColor(light: AnsiColor(33), dark: AnsiColor(39)),
  command: AdaptiveColor(light: AnsiColor(28), dark: AnsiColor(35)),
);

Constructors

HelpColorScheme({Color? heading, Color? command, Color? option, Color? description, Color? error, Color? emphasis, Color? namespace})
Creates a help color scheme with the given colors.
const

Properties

command → Color?
Color for command names.
final
description → Color?
Color for option descriptions.
final
emphasis → Color?
Color for emphasized text (e.g., quotes around command names).
final
error → Color?
Color for error messages.
final
hashCode → int
The hash code for this object.
no setterinherited
heading → Color?
Color for section headings (e.g., "Description:", "Usage:").
final
namespace → Color?
Color for namespace prefixes in command listings.
final
option → Color?
Color for option flags.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

commandStyle(Renderer renderer) → String Function(String)
Returns a styling function for commands.
copyWith({Color? heading, Color? command, Color? option, Color? description, Color? error, Color? emphasis, Color? namespace}) → HelpColorScheme
Creates a copy of this scheme with the given fields replaced.
emphasisStyle(Renderer renderer) → String Function(String)
Returns a styling function for emphasized text.
errorStyle(Renderer renderer) → String Function(String)
Returns a styling function for error messages.
headingStyle(Renderer renderer) → String Function(String)
Returns a styling function for headings.
namespaceStyle(Renderer renderer) → String Function(String)
Returns a styling function for namespaces.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
optionStyle(Renderer renderer) → String Function(String)
Returns a styling function for options.
resolveHeading(Renderer renderer) → String
Resolves the heading color for the given renderer configuration.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

default_ → HelpColorScheme
Default color scheme (matches current behavior).
no setter

Static Methods

dark() → HelpColorScheme
Default color scheme optimized for dark terminals.
light() → HelpColorScheme
Default color scheme optimized for light terminals.
minimal(Color foregroundColor) → HelpColorScheme
Minimal color scheme using a single foreground color.