refactor: changed color of commit message field to match rest of TUI

This commit is contained in:
Slug-Boi
2024-10-21 13:11:20 +02:00
parent 580f56555f
commit b0baa0cf70
2 changed files with 20 additions and 8 deletions
@@ -13,6 +13,11 @@ import (
"github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/textarea" "github.com/charmbracelet/bubbles/textarea"
tea "github.com/charmbracelet/bubbletea" tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)
var (
barStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("170"))
) )
type KeyMap struct { type KeyMap struct {
@@ -53,6 +58,8 @@ type model_cm struct {
func initialModel_cm() model_cm { func initialModel_cm() model_cm {
ti := textarea.New() ti := textarea.New()
ti.FocusedStyle = textarea.Style{Base: lipgloss.NewStyle().Foreground(lipgloss.Color("170"))}
ti.Placeholder = "Write your commit message here..." ti.Placeholder = "Write your commit message here..."
ti.Focus() ti.Focus()
@@ -101,9 +108,8 @@ func (m model_cm) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
func (m model_cm) View() string { func (m model_cm) View() string {
return fmt.Sprintf( return fmt.Sprintf(
"Tell me a story.\n\n%s\n\n%s", "Commit message:\n\n%s\n\n%s",
m.textarea.View(), m.textarea.View(),
"alt+enter|Submit\nctrl+c|Cancel", "(alt+enter | Submit)\n(ctrl+c | Cancel)",
) + "\n\n" ) + "\n\n"
} }
+7 -1
View File
@@ -16,7 +16,9 @@ import (
var content string var content string
var helpStyle_us = lipgloss.NewStyle().Foreground(lipgloss.Color("241")).Render var (
helpStyle_us = lipgloss.NewStyle().Foreground(lipgloss.Color("241")).Render
)
type example struct { type example struct {
viewport viewport.Model viewport viewport.Model
@@ -82,6 +84,10 @@ func (e example) helpView() string {
func Entry_US(author_file string) { func Entry_US(author_file string) {
file, err := os.Open(author_file) file, err := os.Open(author_file)
if err != nil {
fmt.Println("Could not open file:", err)
os.Exit(1)
}
scanner := bufio.NewScanner(file) scanner := bufio.NewScanner(file)
var cnt strings.Builder var cnt strings.Builder