Skip to content

Commit

Permalink
Fix console formatting reset for warn prints
Browse files Browse the repository at this point in the history
  • Loading branch information
gskinner committed Aug 27, 2024
1 parent 44f27a8 commit 491f3d1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/src/warn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import 'package:flutter/foundation.dart';

warn(bool condition, String message) {
if (condition) return;
debugPrint('${_bg(229)}${_fg(0)}[flutter_animate] $message');
debugPrint('${_bg(229)}${_fg(0)}[flutter_animate] $message$_reset');
}

// generate the control codes to set console colors:
_bg(int color) => '\x1B[48;5;${color}m';
_fg(int color) => '\x1B[38;5;${color}m';
String _bg(int color) => '\x1B[48;5;${color}m';
String _fg(int color) => '\x1B[38;5;${color}m';
String _reset = '\x1B[0m';

/*
printColorTest() {
Expand Down

0 comments on commit 491f3d1

Please sign in to comment.