Closed seaneagan closed 4 years ago
I'm not sure why you would need a Zone for this but auto detection as the supports_colors suggest would be very nice to have.
I tend to agree about Zones.
It seems like it would be a good idea to merge supports_color
in this library, or just implement the same logic here.
Looks like ansiSupported
is coming in 1.23 on the Platform
class in dart:io
:
https://github.com/google/platform.dart/pull/4
Looks like ansiSupported
was removed. ansicolor today requires nothing (dart:io or other). You can write this exact line of code in Chrome and it'll work - so this library is still useful for folks there.
console.log('\x1b[36m%s\x1b[34m%s\x1b[0m', 'I am cyan','i am blue');
Stdout.supportsAnsiEscapes
is the new variable. I can make this support browsers as well.
I created a package to detect color support:
https://github.com/seaneagan/supports_color
If #4 were fixed using Zones as suggested, then you just initialize the "color disabled" value in the root Zone to the value from the
supports_color
package, and if folks want to override it, they just use the API provided by #4 to do so.