setBackgroundColor method

void setBackgroundColor(
  1. ConsoleColor background
)

Sets the console background color to a named ANSI color.

There are 16 named ANSI colors, as defined in the ConsoleColor enumeration. Depending on the console theme and background color, some colors may not offer a legible contrast against the background.

Implementation

void setBackgroundColor(ConsoleColor background) {
  stdout.write(background.ansiSetBackgroundColorSequence);
}