Skip to content

Commit

Permalink
fix(ssh): Prefer ANSI color profile
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed May 15, 2024
1 parent d760b9a commit edcba51
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/server/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit edcba51

Please sign in to comment.