From edcba51d863e38a5dd97cc04d0e59a0be437037e Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Wed, 15 May 2024 03:04:51 -0500 Subject: [PATCH] fix(ssh): Prefer ANSI color profile --- internal/server/ssh.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/server/ssh.go b/internal/server/ssh.go index c54e1e25..c31dd4ef 100644 --- a/internal/server/ssh.go +++ b/internal/server/ssh.go @@ -14,6 +14,8 @@ import ( "github.com/charmbracelet/wish/bubbletea" "github.com/gabe565/ascii-movie/internal/movie" "github.com/gabe565/ascii-movie/internal/player" + "github.com/gabe565/ascii-movie/internal/util" + "github.com/muesli/termenv" flag "github.com/spf13/pflag" gossh "golang.org/x/crypto/ssh" "golang.org/x/sync/errgroup" @@ -128,6 +130,12 @@ func (s *SSHServer) Handler(m *movie.Movie) bubbletea.Handler { Logger() renderer := bubbletea.MakeRenderer(session) + if renderer.ColorProfile() == termenv.Ascii { + if pty, _, ok := session.Pty(); ok { + renderer.SetColorProfile(util.Profile(pty.Term)) + } + } + player := player.NewPlayer(m, logger, renderer) return player, []tea.ProgramOption{ tea.WithFPS(30),