Gim/internal/theme/themes/default.go
Hayden Hargreaves 77416bc0a4 feat: created theme module
This means we can finally create some themes! But the treesitter mapping
is not complete.
2026-04-07 21:44:34 -07:00

84 lines
2.1 KiB
Go

package themes
import (
"git.gophernest.net/azpect/TextEditor/internal/theme"
"github.com/charmbracelet/lipgloss"
)
const background = lipgloss.Color("#1f2335")
const foreground = lipgloss.Color("#dcd7ba")
func NewDefaultTheme() theme.EditorTheme {
hightlight := lipgloss.NewStyle().
Background(lipgloss.Color("#2f334d"))
line := lipgloss.NewStyle().
Foreground(foreground).
Background(background)
background := lipgloss.NewStyle().
Background(background)
return theme.EditorTheme{
Cursors: newDefaultCursorTheme(),
Gutter: newDefaultGutterTheme(),
VisualHightlight: hightlight,
StatusBar: newDefaultStatusBarTheme(),
CommandLine: newDefaultCommandLineTheme(),
Line: line,
Background: background,
}
}
// This is only used for the default cursors, in any other case
// the EditorTheme.Cursor() method is preferred.
func newDefaultCursorTheme() theme.CursorTheme {
base := lipgloss.NewStyle().
Foreground(foreground).
Background(background)
inv := lipgloss.NewStyle().
Foreground(background).
Background(foreground)
return theme.CursorTheme{
Normal: inv,
Insert: base.Underline(true),
Command: inv,
Replace: base.Underline(true),
}
}
func newDefaultGutterTheme() theme.GutterTheme {
base := lipgloss.NewStyle().
Background(lipgloss.Color("#181b2a")).
Foreground(lipgloss.Color("#7e8399"))
return theme.GutterTheme{
Default: base,
CurrentLine: base.Foreground(lipgloss.Color("#f6c384")),
}
}
func newDefaultStatusBarTheme() theme.StatusBarTheme {
bar := lipgloss.NewStyle().
Background(lipgloss.Color("#181b2a")).
Foreground(lipgloss.Color("#8ea4a2"))
return theme.StatusBarTheme{
Default: bar,
}
}
func newDefaultCommandLineTheme() theme.CommandLineTheme {
base := lipgloss.NewStyle().
Foreground(foreground).
Background(background)
return theme.CommandLineTheme{
Error: base.Foreground(lipgloss.Color("#e82424")),
OutputBorder: base.Background(lipgloss.Color("#11131d")),
ContinueMessage: base.Foreground(lipgloss.Color("#7aa2f7")),
}
}