zifeo / whiz

Modern DAG/tasks runner for multi-platform monorepos with live reloading, env management, pipes, and more in a tabbed view.
https://metatype.dev/docs/reference/ecosystem?utm_source=github&utm_medium=about&utm_campaign=whiz
Mozilla Public License 2.0
19 stars 14 forks source link

feat: add coloring option #104

Closed boris-sinyapkin closed 10 months ago

boris-sinyapkin commented 10 months ago

This adds new "colors" config sections in the following format:

colors:
   <regex>: [#rgb|<tui-color-name>]

Example:

    command: echo "abc##Hello My Friend!"
    color:
        "^abc": "#eee"
        "My": yellow
        "c#": red

Each line in the panel is scanned for regex patterns listed in "colors" section and matched symbols are colorized according to corresponding RGB color.

I added unit-test covers all implemented functionality. Majority of tests were added to colors module and one test for parsing logic relies in config module.

zifeo commented 10 months ago

@boris-sinyapkin Sorry for the delayed review. Very nice work. The only comment is that this does not look compatible with ansi_to_tui so underlying ascii coloring is ignored. Do you see a way to manage it merged?

boris-sinyapkin commented 10 months ago

@boris-sinyapkin Sorry for the delayed review. Very nice work. The only comment is that this does not look compatible with ansi_to_tui so underlying ascii coloring is ignored. Do you see a way to manage it merged?

Not sure I understand your concern. Could you please describe it more thoroughly or point me to the exact location in the code please?

zifeo commented 10 months ago

@boris-sinyapkin run whiz on the whiz.yaml in the root folder and go to tab "color". You should see:

CleanShot 2023-10-18 at 13 44 50@2x

The [31m and similar are ascii coloring. The feature you implemented is great to add color on non-coloured text, however we should also support underlying colours from the tasks. This is what the ansi_to_tui is doing.

boris-sinyapkin commented 10 months ago

@zifeo wow... Definitely it should support underlying colours ... I somehow missed this. Will update the patch accordingly. Thank you for noticing this.