This commit is contained in:
Anton Medvedev 2023-09-11 18:48:13 +02:00
parent 2c81fe7d8c
commit 845fa0e25e
No known key found for this signature in database
2 changed files with 13 additions and 1 deletions

View File

@ -47,10 +47,12 @@ func main() {
}
}
if flagHelp {
fmt.Println(usage(keyMap))
return
}
if flagVersion {
fmt.Println(version)
return
@ -342,6 +344,10 @@ func (m *model) View() string {
if n.isCollapsed() {
if n.value[0] == '{' {
if n.collapsed.key != nil {
screen = append(screen, currentTheme.Preview(n.collapsed.key)...)
screen = append(screen, colonPreview...)
}
screen = append(screen, dot3...)
screen = append(screen, closeCurlyBracket...)
} else if n.value[0] == '[' {

View File

@ -6,6 +6,7 @@ import (
"github.com/charmbracelet/lipgloss"
"github.com/mazznoer/colorgrad"
"github.com/muesli/termenv"
)
type theme struct {
@ -29,8 +30,12 @@ func init() {
themeId = "1"
}
currentTheme = themes[themeId]
if termenv.ColorProfile() == termenv.Ascii {
currentTheme = themes["0"]
}
colon = currentTheme.Syntax([]byte{':', ' '})
colonPreview = currentTheme.Preview([]byte{':'})
comma = currentTheme.Syntax([]byte{','})
empty = currentTheme.Preview([]byte{'~'})
dot3 = currentTheme.Preview([]byte("…"))
@ -41,7 +46,7 @@ func init() {
var (
currentTheme theme
defaultCursor = toColor(lipgloss.NewStyle().Reverse(true).Render)
defaultPreview = toColor(lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("8")).Render)
defaultPreview = toColor(lipgloss.NewStyle().Foreground(lipgloss.Color("8")).Render)
defaultStatusBar = toColor(lipgloss.NewStyle().Background(lipgloss.Color("7")).Foreground(lipgloss.Color("0")).Render)
defaultSearch = toColor(lipgloss.NewStyle().Background(lipgloss.Color("11")).Foreground(lipgloss.Color("16")).Render)
defaultNull = fg("8")
@ -49,6 +54,7 @@ var (
var (
colon []byte
colonPreview []byte
comma []byte
empty []byte
dot3 []byte