lolcat icon indicating copy to clipboard operation
lolcat copied to clipboard

Issue with screen and 256 colours

Open nyaalex opened this issue 4 years ago • 7 comments

I have been trying to get lolcat to work with screen, and I've been having issues getting the colours to work correctly, attached is an image showing screen on the left, and no screen on the right. I used the script found here to generate the 256 colours that work at the top of the screen.

image

Sorry if this isn't a lolcat issue, but any help would be greatly appreciated

nyaalex avatar Oct 23 '20 14:10 nyaalex

Hello nyaalex,

Did you ever find a solution to this? Much appreciated.

arnowi avatar Dec 16 '22 09:12 arnowi

No, but I did realise it wasn't an issue with lolcat, screen acts funny with 256 colour, I still don't know why, or how to fix it.

nyaalex avatar Dec 16 '22 17:12 nyaalex

I know it can work, it did on my previous work laptop. For some reason it doesn't on my new one despite copying over the same config/rc files as far as I know. It is indeed definitely a screen issue, not ZSH or Bash or Lolcat. Haven't tried with Tmux yet.

I'll post here if I do find a solution.

arnowi avatar Dec 16 '22 20:12 arnowi

@nyaalex I don't think this problem is to do with 256-colour terminals. Your screenshot shows that your terminal is capable of showing all of those colours.

I have encountered this problem myself and have been looking into this and think it's down to an interaction between lolcat, screen and the COLORTERM variable. Terminals can advertise their ability to use 24-bit colour by setting COLORTERM=truecolor. lolcat has some specific handling for this which might be the source of the problem.

Here is the an example using a new screen session in a terminal that sets COLORTERM=truecolor (iTerm). It doesn't render correctly in 24-bit mode but works when I disable that hint.

echo "[$TERM_PROGRAM] [$TERM] [$COLORTERM]"
date | LOLCAT_DEBUG=1 lolcat
date | COLORTERM= LOLCAT_DEBUG=1 lolcat
Terminal output after running the commands directly above this image

Here is the an example using a new screen session in a terminal that doesn't set COLORTERM=truecolor (macOS terminal). It renders correctly but fails when I enable the 24-bit mode hint.

echo "[$TERM_PROGRAM] [$TERM] [$COLORTERM]"
date | LOLCAT_DEBUG=1 lolcat
date | COLORTERM=truecolor LOLCAT_DEBUG=1 lolcat
Terminal output after running the commands directly above this image

Could you please try out unsetting COLORTERM and see if that works for you?

I will continue to dig around the code to see if I can spot the problem. I'm not a ruby developer though, so I might just end up unsetting COLORTERM and leaving it there. We'll see.

biggianteye avatar Dec 22 '23 16:12 biggianteye

Oh yeah, you absolutely are right, unsetting COLORTERM fixes it for me too. I said this was not a lolcat issue because this is common to almost every other application that tries to use 24-bit colour with screen, honestly I don't know why that perl script even works. Actually you have been extremely helpful because I never could figure out how to fix them, and unsetting COLORTERM seems like a fixall.

nyaalex avatar Dec 23 '23 11:12 nyaalex

Oh yeah, you absolutely are right, unsetting COLORTERM fixes it for me too

Great to hear!

I said this was not a lolcat issue because this is common to almost every other application that tries to use 24-bit colour with screen

Can't say that I have knowingly used an application that has tried to use 24-bit colour before, but I'll keep an eye out. Having more examples will help with tracking down the source of the problem.

biggianteye avatar Dec 23 '23 23:12 biggianteye

@biggianteye thanks a lot! finally fixed

ijin82 avatar Jul 19 '24 16:07 ijin82

So the solution is: $ screen $ unset COLORTERM remove -t flag from the invocation of lolcat for whatever $ whatever

?

iconoclasthero avatar Oct 05 '24 22:10 iconoclasthero