mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
Make altscreen demo slightly fancier
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
color = termenv.ColorProfile().Color
|
color = termenv.ColorProfile().Color
|
||||||
keyword = termenv.Style{}.Foreground(color("204")).Background(color("235")).Styled
|
keyword = termenv.Style{}.Foreground(color("204")).Background(color("235")).Styled
|
||||||
|
help = termenv.Style{}.Foreground(color("241")).Styled
|
||||||
)
|
)
|
||||||
|
|
||||||
type model struct {
|
type model struct {
|
||||||
@@ -53,19 +54,15 @@ func (m model) View() string {
|
|||||||
inlineMode = " inline mode "
|
inlineMode = " inline mode "
|
||||||
)
|
)
|
||||||
|
|
||||||
var mode, otherMode string
|
var mode string
|
||||||
if m.altscreen {
|
if m.altscreen {
|
||||||
mode = altscreenMode
|
mode = altscreenMode
|
||||||
otherMode = inlineMode
|
|
||||||
} else {
|
} else {
|
||||||
mode = inlineMode
|
mode = inlineMode
|
||||||
otherMode = altscreenMode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf("\n\n You're in %s\n\n\n", keyword(mode)) +
|
||||||
"\n You're in %s. Press %s to swich to %s.\n\n To exit press %s.\n",
|
help(" space: switch modes • q: exit\n")
|
||||||
keyword(mode), keyword(" space "), keyword(otherMode), keyword(" q "),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user