Very likely due to ghostty setting TERM to xterm-ghostty and your destination not recognizing it. Quick temp fix is using the wrapper (ghostty +ssh), see <https://ghostty.org/docs/features/ssh>. More permanently, copy terminfo to the remote machine, see <https://ghostty.org/docs/features/ssh>.
Yea unfortunately eg Ubuntu’s bashrc has a script which will make it drop colors regardless of the presence of ghostty’s terminfo. Its `screen` will also fail, so e.g. it will refuse to upgrade to a new distro release.
Lots of jank due to this custom terminfo.
You can also just add this to your SSH config to get the typical functionality working:
Host ...
SetEnv TERM=xterm-256color
It’s rude to install a terminfo on a remote machine (which you may not be the owner of). It’s a preposterous for a terminal emulator to install things on a remote machine just to make it work.