Skip to content

Commit 514f8d4

Browse files
committed
feat: color styles
1 parent 4e86fcd commit 514f8d4

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

models/homepage.go

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
tea "github.com/charmbracelet/bubbletea"
77
"github.com/initia-labs/weave/models/weaveinit"
8+
"github.com/initia-labs/weave/styles"
89
"github.com/initia-labs/weave/utils"
910
)
1011

@@ -83,5 +84,6 @@ func (m *Homepage) View() string {
8384
view += "\nPress Enter to select, or q to quit."
8485
}
8586

87+
view += styles.Text("\n?", styles.Cyan) + " Please specify the endpoint to fetch genesis.json " + styles.Text("> add in http format", styles.Gray)
8688
return view
8789
}

styles/text.go

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package styles
2+
3+
import (
4+
"github.com/charmbracelet/lipgloss"
5+
)
6+
7+
type HexColor string
8+
9+
const (
10+
White HexColor = "#FFFFFF"
11+
Cyan HexColor = "#27D8FF"
12+
Green HexColor = "#B0EE5F"
13+
Gray HexColor = "#808080"
14+
Red HexColor = "#FF5656"
15+
)
16+
17+
// Text applies a hex color to a given string and returns the styled string
18+
func Text(text string, color HexColor) string {
19+
style := lipgloss.NewStyle().Foreground(lipgloss.Color(string(color)))
20+
return style.Render(text)
21+
}
22+
23+
// BoldText applies bold and color styling to a string
24+
func BoldText(text string, color HexColor) string {
25+
style := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color(string(color)))
26+
return style.Render(text)
27+
}

0 commit comments

Comments
 (0)