Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with screen and 256 colours #117

Open
nyaalex opened this issue Oct 23, 2020 · 8 comments
Open

Issue with screen and 256 colours #117

nyaalex opened this issue Oct 23, 2020 · 8 comments

Comments

@nyaalex
Copy link

nyaalex commented Oct 23, 2020

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

@arnowi
Copy link

arnowi commented Dec 16, 2022

Hello nyaalex,

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

@nyaalex
Copy link
Author

nyaalex commented Dec 16, 2022

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.

@arnowi
Copy link

arnowi commented Dec 16, 2022

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.

@biggianteye
Copy link

@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.

@nyaalex
Copy link
Author

nyaalex commented Dec 23, 2023

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.

@biggianteye
Copy link

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.

@ijin82
Copy link

ijin82 commented Jul 19, 2024

@biggianteye thanks a lot! finally fixed

@iconoclasthero
Copy link

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

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants