robertmarsal / lolcatjs

For the lols
Other
110 stars 10 forks source link

weird coloring behavior? #3

Closed kumavis closed 7 years ago

kumavis commented 8 years ago

using osx stock terminal

zsh

image

╭─kumavis@xyzs-MacBook-Pro  ~/dev/web3-provider-skeleton ‹node-v0.12.7›  (master*) 
╰─$ fortune | cowsay | lolcatjs
 ______________________________________ 
/ QOTD:                                \
|                                      |
| "I drive my car quietly, for it goes |
\ without saying."                     /
 -------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

bash

image

╭─kumavis@xyzs-MacBook-Pro  ~/dev/web3-provider-skeleton ‹node-v0.12.7›  (master*) 
╰─$ bash                       
bash-3.2$ fortune | cowsay | lolcatjs
 _________________________________________ 
/ Whatever women do they must do twice as \
| well as men to be thought half as good. |
| Luckily this is not difficult.          |
|                                         |
\ -- Charlotte Whitton                    /
 ----------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
jbcpollak commented 7 years ago

I have this problem as well, but the Ruby lolcat seems to work fine. I think it has to do with parsing the truecolor ansi codes, but it looks like Ruby's lolcat does the same.

robertmarsal commented 7 years ago

I finally had access to a mac and could work on this. Sorry it took so long 😜. The output should look fine from version 2.0.1 on (already pushed to npm).

Closing the issue as this should be fixed, but if you still have problems feel free to let me know here or create another issue.

Thanks, Rob

jbcpollak commented 7 years ago

verified, it works great, thanks!

kumavis commented 7 years ago

beautiful 👌

kumavis commented 7 years ago

It does seem to mess up the ears, but oh well

╭─kumavis@xyzs-MacBook-Pro  ~/dev/ethereumjs-ipld-dump ‹node-v6.3.1›  (master*) 
╰─$ fortune | cowsay  | lolcatjs
 ________________________________________ 
/ Military secrets are the most fleeting \
| of all.                                |
|                                        |
| -- Spock, "The Enterprise Incident",   |
\ stardate 5027.4                        /
 ---------------------------------------- 
        \   __
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

compare to

╭─kumavis@xyzs-MacBook-Pro  ~/dev/ethereumjs-ipld-dump ‹node-v6.3.1›  (master*) 
╰─$ fortune | cowsay   
 ________________________________________ 
/ Try the Moo Shu Pork. It is especially \
\ good today.                            /
 ---------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
robertmarsal commented 7 years ago

@kumavis nice catch! It seems to be caused by one of the project dependencies using the caret symbol for custom styling. I added some code to make sure the chars are being escaped before being passed on to the library. It should work fine as of 2.0.2.

Thanks, Rob