toAnsi method

  1. @override
String toAnsi(
  1. ColorProfile profile, {
  2. bool background = false,
  3. bool underline = false,
  4. bool hasDarkBackground = true,
})
override

Produces the ANSI escape sequence for this color.

profile indicates the terminal's color capabilities. background if true, produces background color sequence. underline if true, produces underline color sequence (SGR 58). hasDarkBackground hints whether terminal has dark background (for adaptive colors).

Implementation

@override
String toAnsi(
  ColorProfile profile, {
  bool background = false,
  bool underline = false,
  bool hasDarkBackground = true,
}) {
  final color = hasDarkBackground ? dark : light;
  return color.toAnsi(
    profile,
    background: background,
    underline: underline,
    hasDarkBackground: hasDarkBackground,
  );
}