Support 16 colors in IO.ANSI?

85 views
Skip to first unread message

Travis Herrick

unread,
Sep 10, 2016, 9:45:47 PM9/10/16
to elixir-lang-core
Hello everyone,

I'm just getting started with elixir and I'm starting with command line applications where I tend to use a lot of ansi colors in my applications. Unless I'm missing something, IO.ANSI only supports the 8 base colors, which can be combined with things like bright, faint, underlined, etc. Right now, combining red and bright actually gives me bold light red. I would like to be able to leverage all 16 base colors via IO.ANSI.

Would it be ok to add the light versions of foreground colors (ansi codes 90-97) and background colors (ansi codes 100-107)? I have looked at the code already and I'm more than willing to do the work and submit a pull request.

Thanks,
-Travis

José Valim

unread,
Sep 15, 2016, 10:22:53 AM9/15/16
to elixir-lang-core
Would it be ok to add the light versions of foreground colors (ansi codes 90-97) and background colors (ansi codes 100-107)? I have looked at the code already and I'm more than willing to do the work and submit a pull request.

Yes, please! :D What do you have in mind for the names? light_red, light_cyan and so on?

Travis Herrick

unread,
Sep 20, 2016, 3:20:23 AM9/20/16
to elixir-lang-core
That's exactly what I was thinking. I haven't made any changes yet, but I have 3 failing specs. Is this there a better forum for working through any troubles I have getting specs to pass?

They all appear to be around testing updating dependencies (deps.git_test.exs). `** (File.Error) could not write to file ".git/info/sparse-checkout": no such file or directory`

I kept that brief in case this is not the correct forum for troubleshooting this.

José Valim

unread,
Sep 20, 2016, 3:27:57 AM9/20/16
to elixir-l...@googlegroups.com
Hi Travis, I believe it is because you have an old Git version. What is your "git --version"? It is fine to discuss it in this forum (thanks for checking!).

Anyway, those are failures in the Mix application and you don't need to worry about those for your patch. Running "make test_stdlib" should be enough.



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/c6cdf1dc-e3ae-474e-868d-a59ed9170dfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Travis Herrick

unread,
Sep 20, 2016, 3:42:06 AM9/20/16
to elixir-lang-core, jose....@plataformatec.com.br
My git version is 2.7.4.

How do I know when I need to run `make clean`?


On Tuesday, September 20, 2016 at 12:27:57 AM UTC-7, José Valim wrote:
Hi Travis, I believe it is because you have an old Git version. What is your "git --version"? It is fine to discuss it in this forum (thanks for checking!).

Anyway, those are failures in the Mix application and you don't need to worry about those for your patch. Running "make test_stdlib" should be enough.



José Valim
Skype: jv.ptec
Founder and Director of R&D

On Tue, Sep 20, 2016 at 9:20 AM, Travis Herrick <tthe...@gmail.com> wrote:
That's exactly what I was thinking. I haven't made any changes yet, but I have 3 failing specs. Is this there a better forum for working through any troubles I have getting specs to pass?

They all appear to be around testing updating dependencies (deps.git_test.exs). `** (File.Error) could not write to file ".git/info/sparse-checkout": no such file or directory`

I kept that brief in case this is not the correct forum for troubleshooting this.

On Thursday, September 15, 2016 at 7:22:53 AM UTC-7, José Valim wrote:
Would it be ok to add the light versions of foreground colors (ansi codes 90-97) and background colors (ansi codes 100-107)? I have looked at the code already and I'm more than willing to do the work and submit a pull request.

Yes, please! :D What do you have in mind for the names? light_red, light_cyan and so on?

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.

Travis Herrick

unread,
Sep 20, 2016, 3:48:49 AM9/20/16
to elixir-lang-core, jose....@plataformatec.com.br
Also... Is there a way to run a specific spec using the filename (and ideally a line number)?

I know how to do this with mix, but I'm not sure with make.

José Valim

unread,
Sep 20, 2016, 4:28:34 AM9/20/16
to elixir-l...@googlegroups.com
In Elixir you can do it as: elixirc lib/elixir/lib/io/ansi.ex -o lib/elixir/ebin && elixir lib/elixir/test/elixir/io/ansi_test.exs

I believe a "make clean" would fix your sparse issues given you are on a Git version that supports sparse.



José Valim
Skype: jv.ptec
Founder and Director of R&D

To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/410612b2-d8ff-4d87-9628-b12b18a1f2e2%40googlegroups.com.

eksperimental

unread,
Sep 20, 2016, 4:46:32 AM9/20/16
to elixir-l...@googlegroups.com
Hi Travis,
I have written to deal with what you need
https://git.io/make-test-file

save it in the elixir folder, and run
./make-test-file lib/elixir/test/elixir/io/ansi_test.exs

cheers

On Tue, 20 Sep 2016 00:48:49 -0700 (PDT)
Travis Herrick <tthe...@gmail.com> wrote:

> Also... Is there a way to run a specific spec using the filename (and
> ideally a line number)?
>
> I know how to do this with mix, but I'm not sure with make.
>
> On Tuesday, September 20, 2016 at 12:42:06 AM UTC-7, Travis Herrick wrote:
> >
> > My git version is 2.7.4.
> >
> > How do I know when I need to run `make clean`?
> >
> > On Tuesday, September 20, 2016 at 12:27:57 AM UTC-7, José Valim wrote:
> >>
> >> Hi Travis, I believe it is because you have an old Git version. What is
> >> your "git --version"? It is fine to discuss it in this forum (thanks for
> >> checking!).
> >>
> >> Anyway, those are failures in the Mix application and you don't need to
> >> worry about those for your patch. Running "make test_stdlib" should be
> >> enough.
> >>
> >>
> >>
> >> *José Valim*
> >>> <https://groups.google.com/d/msgid/elixir-lang-core/c6cdf1dc-e3ae-474e-868d-a59ed9170dfc%40googlegroups.com?utm_medium=email&utm_source=footer>
> >>> .
Reply all
Reply to author
Forward
0 new messages