hasDarkBackground property

bool hasDarkBackground
final

Whether the terminal has a dark background.

When true (default), uses dark-optimized themes and colors. When false, uses light-optimized themes and colors.

This affects:

  • Syntax highlighting theme selection (when using AdaptiveChromaTheme)
  • Adaptive colors in custom styles

You can detect this automatically using TerminalThemeState:

final options = AnsiRendererOptions(
  hasDarkBackground: terminalTheme.hasDarkBackground ?? true,
);

Implementation

final bool hasDarkBackground;