ConsoleTagParser constructor

ConsoleTagParser({
  1. ColorProfile colorProfile = ColorProfile.trueColor,
  2. bool hasDarkBackground = true,
})

Creates a new console tag parser with default named styles.

Implementation

ConsoleTagParser({
  ColorProfile colorProfile = ColorProfile.trueColor,
  bool hasDarkBackground = true,
}) : _colorProfile = colorProfile,
     _hasDarkBackground = hasDarkBackground {
  // Register default Symfony-style named styles
  _namedStyles['info'] = Style().foreground(Colors.green);
  _namedStyles['comment'] = Style().foreground(Colors.yellow);
  _namedStyles['question'] = Style()
      .foreground(Colors.black)
      .background(Colors.cyan);
  _namedStyles['error'] = Style()
      .foreground(Colors.white)
      .background(Colors.red);

  // Additional useful named styles
  _namedStyles['success'] = Style().foreground(Colors.green);
  _namedStyles['warning'] = Style().foreground(Colors.yellow);
  _namedStyles['danger'] = Style().foreground(Colors.red);
  _namedStyles['muted'] = Style().foreground(Colors.gray);
  _namedStyles['bold'] = Style().bold();
  _namedStyles['dim'] = Style().faint();
  _namedStyles['italic'] = Style().italic();
  _namedStyles['underline'] = Style().underline();
  _namedStyles['strikethrough'] = Style().strikethrough();
}