onepub-dev / dcli

An extensive library and tooling for building console/cli applications and scripts using the Dart programming language.
242 stars 28 forks source link

Make AnsiColor class and its static colour variables public #114

Closed graphicbeacon closed 3 years ago

graphicbeacon commented 3 years ago

In the documentation section for colour coding we are given the following example for colour coding our text output:

print(orange('hello world', bgcolor: AnsiColor.black));

When trying to set the background colour, I noticed that I wasn't able to use AnsiColor.black or any other of the static colours. Some further digging brought me to this line in the codebase which hides the AnsiColor class:

// dcli.dart
export 'src/util/ansi_color.dart' hide AnsiColor;

Also the AnsiColor class has set the static colours as private.

Describe the solution you'd like Solution involves removing the hide clause and making the static colours public.

Describe alternatives you've considered In the meantime I'm invoking AnsiColor directly and passing an integer for the colour, so AnsiColor(30) for black and AnsiColor(31) for red etc... I've made the changes and plan on raising a pull request shortly.

Hopefully it follows the guidelines for this project.

graphicbeacon commented 3 years ago

@bsutton Released a PR to resolve this. Let me know what you think.

bsutton commented 3 years ago

Will be released in 0.24.2