styles.go

  1package styles
  2
  3import (
  4	"github.com/charmbracelet/lipgloss"
  5	"github.com/opencode-ai/opencode/internal/tui/theme"
  6)
  7
  8var (
  9	ImageBakcground = "#212121"
 10)
 11
 12// Style generation functions that use the current theme
 13
 14// BaseStyle returns the base style with background and foreground colors
 15func BaseStyle() lipgloss.Style {
 16	t := theme.CurrentTheme()
 17	return lipgloss.NewStyle().
 18		Background(t.Background()).
 19		Foreground(t.Text())
 20}
 21
 22// Regular returns a basic unstyled lipgloss.Style
 23func Regular() lipgloss.Style {
 24	return lipgloss.NewStyle()
 25}
 26
 27// Bold returns a bold style
 28func Bold() lipgloss.Style {
 29	return Regular().Bold(true)
 30}
 31
 32// Padded returns a style with horizontal padding
 33func Padded() lipgloss.Style {
 34	return Regular().Padding(0, 1)
 35}
 36
 37// Border returns a style with a normal border
 38func Border() lipgloss.Style {
 39	t := theme.CurrentTheme()
 40	return Regular().
 41		Border(lipgloss.NormalBorder()).
 42		BorderForeground(t.BorderNormal())
 43}
 44
 45// ThickBorder returns a style with a thick border
 46func ThickBorder() lipgloss.Style {
 47	t := theme.CurrentTheme()
 48	return Regular().
 49		Border(lipgloss.ThickBorder()).
 50		BorderForeground(t.BorderNormal())
 51}
 52
 53// DoubleBorder returns a style with a double border
 54func DoubleBorder() lipgloss.Style {
 55	t := theme.CurrentTheme()
 56	return Regular().
 57		Border(lipgloss.DoubleBorder()).
 58		BorderForeground(t.BorderNormal())
 59}
 60
 61// FocusedBorder returns a style with a border using the focused border color
 62func FocusedBorder() lipgloss.Style {
 63	t := theme.CurrentTheme()
 64	return Regular().
 65		Border(lipgloss.NormalBorder()).
 66		BorderForeground(t.BorderFocused())
 67}
 68
 69// DimBorder returns a style with a border using the dim border color
 70func DimBorder() lipgloss.Style {
 71	t := theme.CurrentTheme()
 72	return Regular().
 73		Border(lipgloss.NormalBorder()).
 74		BorderForeground(t.BorderDim())
 75}
 76
 77// PrimaryColor returns the primary color from the current theme
 78func PrimaryColor() lipgloss.AdaptiveColor {
 79	return theme.CurrentTheme().Primary()
 80}
 81
 82// SecondaryColor returns the secondary color from the current theme
 83func SecondaryColor() lipgloss.AdaptiveColor {
 84	return theme.CurrentTheme().Secondary()
 85}
 86
 87// AccentColor returns the accent color from the current theme
 88func AccentColor() lipgloss.AdaptiveColor {
 89	return theme.CurrentTheme().Accent()
 90}
 91
 92// ErrorColor returns the error color from the current theme
 93func ErrorColor() lipgloss.AdaptiveColor {
 94	return theme.CurrentTheme().Error()
 95}
 96
 97// WarningColor returns the warning color from the current theme
 98func WarningColor() lipgloss.AdaptiveColor {
 99	return theme.CurrentTheme().Warning()
100}
101
102// SuccessColor returns the success color from the current theme
103func SuccessColor() lipgloss.AdaptiveColor {
104	return theme.CurrentTheme().Success()
105}
106
107// InfoColor returns the info color from the current theme
108func InfoColor() lipgloss.AdaptiveColor {
109	return theme.CurrentTheme().Info()
110}
111
112// TextColor returns the text color from the current theme
113func TextColor() lipgloss.AdaptiveColor {
114	return theme.CurrentTheme().Text()
115}
116
117// TextMutedColor returns the muted text color from the current theme
118func TextMutedColor() lipgloss.AdaptiveColor {
119	return theme.CurrentTheme().TextMuted()
120}
121
122// TextEmphasizedColor returns the emphasized text color from the current theme
123func TextEmphasizedColor() lipgloss.AdaptiveColor {
124	return theme.CurrentTheme().TextEmphasized()
125}
126
127// BackgroundColor returns the background color from the current theme
128func BackgroundColor() lipgloss.AdaptiveColor {
129	return theme.CurrentTheme().Background()
130}
131
132// BackgroundSecondaryColor returns the secondary background color from the current theme
133func BackgroundSecondaryColor() lipgloss.AdaptiveColor {
134	return theme.CurrentTheme().BackgroundSecondary()
135}
136
137// BackgroundDarkerColor returns the darker background color from the current theme
138func BackgroundDarkerColor() lipgloss.AdaptiveColor {
139	return theme.CurrentTheme().BackgroundDarker()
140}
141
142// BorderNormalColor returns the normal border color from the current theme
143func BorderNormalColor() lipgloss.AdaptiveColor {
144	return theme.CurrentTheme().BorderNormal()
145}
146
147// BorderFocusedColor returns the focused border color from the current theme
148func BorderFocusedColor() lipgloss.AdaptiveColor {
149	return theme.CurrentTheme().BorderFocused()
150}
151
152// BorderDimColor returns the dim border color from the current theme
153func BorderDimColor() lipgloss.AdaptiveColor {
154	return theme.CurrentTheme().BorderDim()
155}