mirror of
https://github.com/antonmedv/fx
synced 2024-11-05 12:00:46 +00:00
wip
This commit is contained in:
parent
2c81fe7d8c
commit
845fa0e25e
@ -47,10 +47,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if flagHelp {
|
if flagHelp {
|
||||||
fmt.Println(usage(keyMap))
|
fmt.Println(usage(keyMap))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if flagVersion {
|
if flagVersion {
|
||||||
fmt.Println(version)
|
fmt.Println(version)
|
||||||
return
|
return
|
||||||
@ -342,6 +344,10 @@ func (m *model) View() string {
|
|||||||
|
|
||||||
if n.isCollapsed() {
|
if n.isCollapsed() {
|
||||||
if n.value[0] == '{' {
|
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, dot3...)
|
||||||
screen = append(screen, closeCurlyBracket...)
|
screen = append(screen, closeCurlyBracket...)
|
||||||
} else if n.value[0] == '[' {
|
} else if n.value[0] == '[' {
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
"github.com/mazznoer/colorgrad"
|
"github.com/mazznoer/colorgrad"
|
||||||
|
"github.com/muesli/termenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type theme struct {
|
type theme struct {
|
||||||
@ -29,8 +30,12 @@ func init() {
|
|||||||
themeId = "1"
|
themeId = "1"
|
||||||
}
|
}
|
||||||
currentTheme = themes[themeId]
|
currentTheme = themes[themeId]
|
||||||
|
if termenv.ColorProfile() == termenv.Ascii {
|
||||||
|
currentTheme = themes["0"]
|
||||||
|
}
|
||||||
|
|
||||||
colon = currentTheme.Syntax([]byte{':', ' '})
|
colon = currentTheme.Syntax([]byte{':', ' '})
|
||||||
|
colonPreview = currentTheme.Preview([]byte{':'})
|
||||||
comma = currentTheme.Syntax([]byte{','})
|
comma = currentTheme.Syntax([]byte{','})
|
||||||
empty = currentTheme.Preview([]byte{'~'})
|
empty = currentTheme.Preview([]byte{'~'})
|
||||||
dot3 = currentTheme.Preview([]byte("…"))
|
dot3 = currentTheme.Preview([]byte("…"))
|
||||||
@ -41,7 +46,7 @@ func init() {
|
|||||||
var (
|
var (
|
||||||
currentTheme theme
|
currentTheme theme
|
||||||
defaultCursor = toColor(lipgloss.NewStyle().Reverse(true).Render)
|
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)
|
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)
|
defaultSearch = toColor(lipgloss.NewStyle().Background(lipgloss.Color("11")).Foreground(lipgloss.Color("16")).Render)
|
||||||
defaultNull = fg("8")
|
defaultNull = fg("8")
|
||||||
@ -49,6 +54,7 @@ var (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
colon []byte
|
colon []byte
|
||||||
|
colonPreview []byte
|
||||||
comma []byte
|
comma []byte
|
||||||
empty []byte
|
empty []byte
|
||||||
dot3 []byte
|
dot3 []byte
|
||||||
|
Loading…
Reference in New Issue
Block a user