red-data-tools / unicode_plot.rb

Plot your data by Unicode characters
MIT License
246 stars 12 forks source link

Addressing color palette issue in issue #34 #36

Closed nanobowers closed 3 years ago

nanobowers commented 3 years ago

Some support for 256 color mode was allowed in the styled_printer.rb, however it could not be fully accessed. I have updated the code to allow for a numeric value of a color (0..255) to be used, or a symbol.

Some things that i have found doing this:

I believe this will fix issue #34 from @kojix2 , but If there is a desire to support the full range of the basic 16 ANSI color palette or blending is needed for the 256 color palette then we will need to consider more complex methods to handle it.

mrkn commented 3 years ago

First, thank you for your pull-request. I consider how to handle this and I decided that I don't merge this.

My consideration is below:

kojix2 commented 3 years ago

I don't know what it is, but it's a pity I can't use a lot of colors...

Never mind. This is just a statement of my feelings. Not about the coding.

mrkn commented 3 years ago

At least @colors[index] |= COLOR_ENCODE.fetch(color, color) isn't acceptable to me. Even if this change is merged, you cannot use many colors for every case.

nanobowers commented 3 years ago

@mrkn I agree with your assessment. This fix was kind of a hack, and is not a good long term solution. I will close this request.

To fix this properly will require better support for 256 color mode (and true 24bit) which is more complex and will take some time. Sorry to get your hopes up, @kojix2 - i will try to look at that again when i am finished working on #30