Skip to content
Myr

Make altscreen demo slightly fancier

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent 01878b5 · Browse files · 1 file+4 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−7 removed

  • other:+4 added−7 removed

1 file+4 added−7 removed

modified:examples/altscreen-toggle/main.go+4 added-7 removed
9 unmodified lines
1011var (12 color = termenv.ColorProfile().Color13 keyword = termenv.Style{}.Foreground(color("204")).Background(color("235")).Styled14 help = termenv.Style{}.Foreground(color("241")).Styled15)1617type model struct {18 altscreen bool
34 unmodified lines
53 altscreenMode = " altscreen mode "54 inlineMode = " inline mode "55 )5656 var mode, otherMode string57 var mode string58 if m.altscreen {59 mode = altscreenMode59 otherMode = inlineMode60 } else {61 mode = inlineMode62 otherMode = altscreenMode62 }6365 return fmt.Sprintf(66 "\n You're in %s. Press %s to swich to %s.\n\n To exit press %s.\n",67 keyword(mode), keyword(" space "), keyword(otherMode), keyword(" q "),68 )64 return fmt.Sprintf("\n\n You're in %s\n\n\n", keyword(mode)) +65 help(" space: switch modes • q: exit\n")66}6768func main() {69 if err := tea.NewProgram(model{}).Start(); err != nil {
4 unmodified lines