Skip to content

Instantly share code, notes, and snippets.

@Abdurrahman98XX
Created November 29, 2024 18:17
Show Gist options
  • Select an option

  • Save Abdurrahman98XX/18bbe9fdf085a067a3fd0290c89530b3 to your computer and use it in GitHub Desktop.

Select an option

Save Abdurrahman98XX/18bbe9fdf085a067a3fd0290c89530b3 to your computer and use it in GitHub Desktop.
// ignore_for_file: library_private_types_in_public_api
extension AnsiColorLog on String {
_FG get fg => _FG(this);
_BG get bg => _BG(this);
}
/// Colors for the ForeGround
class _FG {
const _FG(this.t);
final String t;
String get black => '\x1B[30m$t\x1B[0m';
String get red => '\x1B[31m$t\x1B[0m';
String get green => '\x1B[32m$t\x1B[0m';
String get yellow => '\x1B[33m$t\x1B[0m';
String get blue => '\x1B[34m$t\x1B[0m';
String get magenta => '\x1B[35m$t\x1B[0m';
String get cyan => '\x1B[36m$t\x1B[0m';
String get white => '\x1B[37m$t\x1B[0m';
String get blackBright => '\x1B[90m$t\x1B[0m';
String get redBright => '\x1B[91m$t\x1B[0m';
String get greenBright => '\x1B[92m$t\x1B[0m';
String get yellowBright => '\x1B[93m$t\x1B[0m';
String get blueBright => '\x1B[94m$t\x1B[0m';
String get magentaBright => '\x1B[95m$t\x1B[0m';
String get cyanBright => '\x1B[96m$t\x1B[0m';
String get whiteBright => '\x1B[97m$t\x1B[0m';
}
/// Colors for the BackGround
class _BG {
const _BG(this.t);
final String t;
String get black => '\x1B[40m$t\x1B[0m';
String get red => '\x1B[41m$t\x1B[0m';
String get green => '\x1B[42m$t\x1B[0m';
String get yellow => '\x1B[43m$t\x1B[0m';
String get blue => '\x1B[44m$t\x1B[0m';
String get magenta => '\x1B[45m$t\x1B[0m';
String get cyan => '\x1B[46m$t\x1B[0m';
String get white => '\x1B[47m$t\x1B[0m';
String get blackBright => '\x1B[100m$t\x1B[0m';
String get redBright => '\x1B[101m$t\x1B[0m';
String get greenBright => '\x1B[102m$t\x1B[0m';
String get yellowBright => '\x1B[103m$t\x1B[0m';
String get blueBright => '\x1B[104m$t\x1B[0m';
String get magentaBright => '\x1B[105m$t\x1B[0m';
String get cyanBright => '\x1B[106m$t\x1B[0m';
String get whiteBright => '\x1B[107m$t\x1B[0m';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment