poetaman / arttime

arttime is a CLI application that blends beauty of ASCII / text art with functionality of clock / timer / pattern-based time manager in terminal ⏰
Other
938 stars 15 forks source link

feature request: add support for lolcat #42

Closed ehaupt closed 1 year ago

ehaupt commented 2 years ago

It would be nice to have support for a lolcat color filter :smiley_cat:

poetaman commented 2 years ago

@ehaupt Yes it would be a nice feature to have. It's actually pretty simple to achieve that, though I didn't add it as there are so many filters possible, and I wasn't sure about the best interface. Consider this problem: Filters tend to have a lot of options, and every user would want a slightly different option. So let's say we add an option --filter '<filter command_with_options>'. If passed, arttime will execute this string '<filter command_with_options>' each time a new text art is loaded in arttime. While on a home system this might not be an issue. But adding an option like --filter '<filter command_with_options>' could make something like arttime an eye sore for ones IT team IMO. What are your thoughts on it?

There are two other ways we can go about:

  1. Add an option --filter <name> the string name won't be evaluated but act as a key to a set of filters we support with certain standard options. Like --filter lolcat would execute something like command lolcat -f...
  2. arttime implements a function in zsh to add random colors, and support both 16/256 colors.

Arttime already has some files with color filter applied using lolcat for a simple disco effect. Try the following:

arttime --nolearn -a butterfly2 -b butterfly3

To immediately get that same effect on any other art, do something like this (example for text artnews):

cd /path/to/share/arttime/textart/
lolcat -f news >news_lol1
lolcat -f news >news_lol2
arttime --nolearn -a news_lol1 -b news_lol2
ehaupt commented 2 years ago

Thank you for your explanation. Other project use an argument to pass arguments to external commands:

Eg.: scp(1):

     -o ssh_option
             Can be used to pass options to ssh in the format used in
             ssh_config(5).  This is useful for specifying options for which
             there is no separate scp command-line flag.  For full details of
             the options listed below, and their possible values, see
             ssh_config(5).

But your proposed solution is perfectly reasonable. Please feel free to close the issue.

poetaman commented 1 year ago

@ehaupt Btw, there is one more route possible for this. I had tested some color cat filters to see if they work. Most seem to have trouble handling escape sequences. The one filter that more or less works with least hiccups is this ruby implementation of lolcat:

arttime --nolearn -a winnepooh -b winnepooh2 -t "Ooops, colored bear" | lolcat

Here's a GIF: arttime_lolcat_filter2

In future with people filing bugs on the maintainers of these filters will make them more resilient, and perhaps the faster C version will also be usable. Here's an example bug: https://github.com/busyloop/lolcat/issues/110. Unfortunately none have 16-color support, they are either 256 color or RGB color...