Skip to content

Commit

Permalink
feat: created shared color library polish
Browse files Browse the repository at this point in the history
  • Loading branch information
mistakenelf committed Mar 26, 2024
1 parent 3065ecb commit 890b5ac
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
3 changes: 2 additions & 1 deletion code/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/charmbracelet/lipgloss"

"github.com/mistakenelf/fm/filesystem"
"github.com/mistakenelf/fm/polish"
)

type syntaxMsg string
Expand Down Expand Up @@ -148,7 +149,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
m.Filename = ""
cmds = append(cmds, m.NewStatusMessageCmd(
lipgloss.NewStyle().
Foreground(lipgloss.Color("#cc241d")).
Foreground(polish.Colors.Red600).
Bold(true).
Render(string(msg)),
))
Expand Down
3 changes: 2 additions & 1 deletion filetree/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/charmbracelet/lipgloss"

"github.com/mistakenelf/fm/filesystem"
"github.com/mistakenelf/fm/polish"
)

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
Expand All @@ -26,7 +27,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
case errorMsg:
cmds = append(cmds, m.NewStatusMessageCmd(
lipgloss.NewStyle().
Foreground(lipgloss.Color("#cc241d")).
Foreground(polish.Colors.Red600).
Bold(true).
Render(string(msg))))
case statusMessageTimeoutMsg:
Expand Down
4 changes: 3 additions & 1 deletion image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/charmbracelet/lipgloss"
"github.com/disintegration/imaging"
"github.com/lucasb-eyer/go-colorful"

"github.com/mistakenelf/fm/polish"
)

type convertImageToStringMsg string
Expand Down Expand Up @@ -164,7 +166,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
case errorMsg:
cmds = append(cmds, m.NewStatusMessageCmd(
lipgloss.NewStyle().
Foreground(lipgloss.Color("#cc241d")).
Foreground(polish.Colors.Red600).
Bold(true).
Render(string(msg)),
))
Expand Down
3 changes: 2 additions & 1 deletion internal/tui/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/mistakenelf/fm/polish"
)

var forbiddenExtensions = []string{
Expand Down Expand Up @@ -47,7 +48,7 @@ func (m *model) openFileCmd() tea.Cmd {
return m.pdf.SetFileNameCmd(selectedFile.Path)
case contains(forbiddenExtensions, selectedFile.Extension):
return m.newStatusMessageCmd(lipgloss.NewStyle().
Foreground(lipgloss.Color("#cc241d")).
Foreground(polish.Colors.Red600).
Bold(true).
Render("Selected file type is not supported"))
default:
Expand Down
3 changes: 2 additions & 1 deletion markdown/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/charmbracelet/lipgloss"

"github.com/mistakenelf/fm/filesystem"
"github.com/mistakenelf/fm/polish"
)

type renderMarkdownMsg string
Expand Down Expand Up @@ -154,7 +155,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
m.FileName = ""
cmds = append(cmds, m.NewStatusMessageCmd(
lipgloss.NewStyle().
Foreground(lipgloss.Color("#cc241d")).
Foreground(polish.Colors.Red600).
Bold(true).
Render(string(msg)),
))
Expand Down
3 changes: 2 additions & 1 deletion pdf/pdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/ledongthuc/pdf"
"github.com/mistakenelf/fm/polish"
)

type renderPDFMsg string
Expand Down Expand Up @@ -149,7 +150,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
m.FileName = ""
cmds = append(cmds, m.NewStatusMessageCmd(
lipgloss.NewStyle().
Foreground(lipgloss.Color("#cc241d")).
Foreground(polish.Colors.Red600).
Bold(true).
Render(string(msg)),
))
Expand Down
11 changes: 11 additions & 0 deletions polish/polish.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package polish

import "github.com/charmbracelet/lipgloss"

type ColorMap struct {
Red600 lipgloss.Color
}

var Colors = ColorMap{
Red600: lipgloss.Color("#dc2626"),
}

0 comments on commit 890b5ac

Please sign in to comment.