Dart-code: Colored text in debug console (feature request)

Created on 25 Jan 2019  路  8Comments  路  Source: Dart-Code/Dart-Code

Debug console doesn't support colored text output now.
Is there any chance to see that functionality?

For text coloring I use ansicolor package (https://pub.dartlang.org/packages/ansicolor).

fixed in vs code

Most helpful comment

The VS Code changes have landed so this should be fixed in vNext (and in Insiders from later today/tomorrow?):

https://github.com/Microsoft/vscode/issues/67217

All 8 comments

Can you provide some sample code and a screenshot of what's happening? Is it a Dart or Flutter project?

You say it doesn't support it "now" - does this mean it used to work? (I would assume so, but since you wrote Feature Request in the title, I'm not so sure).

Yeah, sure!
It's a Console Dart (2.1) project on Windows.
Simple example:

dependencies:
  ansicolor: ^1.0.2
import 'package:ansicolor/ansicolor.dart';

main(List<String> arguments) {
  AnsiPen greenPen = AnsiPen()..green();
  AnsiPen greenBackGroundPen = AnsiPen()..green(bg: true);

  AnsiPen redTextBlueBackgroundPen = AnsiPen()..blue(bg: true)..red();

  AnsiPen boldPen = AnsiPen()..white(bold: true);

  AnsiPen someColorPen = AnsiPen()..rgb(r: .5, g: .2, b: .4);

  print(greenPen("Hulk") + " " + greenBackGroundPen("SMASH!!!"));
  print(redTextBlueBackgroundPen("Spider-Man!!!") + " " + boldPen("Far From Home!!!"));

  print(someColorPen("Chameleon"));
}

terminal
debug_console

I'm not sure if it is bug or not.
But it seems that Debug Console has some support of text coloring due to screenshots.

Thanks, I'll see what I can find. I think VS Code might only support a small set of colours, but I'll do some testing.

Ok, after some digging I've found that VS Code seems to ignore colours when in the 256-color format. These should be the same colour:

// tested with TS to eliminate Dart as a variable
const t1 = "\x1B[32m       test   \x1B[0m";
const t2 = "\x1B[38;5;2m   test   \x1B[0m";
console.log(t1);
console.log(t2);

Outputs:

screenshot 2019-01-28 at 10 01 09 am

So I've opened an issue with VS Code, please add a 馃憤!

https://github.com/Microsoft/vscode/issues/67217

Thanks for looking into this)

No problem, I would've expected it to work!

I'll close this since it's a VS issue and once they fix it it should just working here. You may wish to subscribe to that issue for updates. If it seems like it's not being fixed in a while, then ping me back here and we can investigate whether we could put some workaround in (for ex. squishing them into the 8-color palette) to at least get some colour.

FYI - there's an open PR against Code that fixes this issue. Sound like it won't make the next release though, so it's probably early May at best.

https://github.com/Microsoft/vscode/pull/70935

image

The VS Code changes have landed so this should be fixed in vNext (and in Insiders from later today/tomorrow?):

https://github.com/Microsoft/vscode/issues/67217

Was this page helpful?
0 / 5 - 0 ratings