summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/styles
diff options
context:
space:
mode:
Diffstat (limited to 'packages/tui/internal/styles')
-rw-r--r--packages/tui/internal/styles/background.go4
-rw-r--r--packages/tui/internal/styles/markdown.go117
-rw-r--r--packages/tui/internal/styles/styles.go151
-rw-r--r--packages/tui/internal/styles/utilities.go295
4 files changed, 363 insertions, 204 deletions
diff --git a/packages/tui/internal/styles/background.go b/packages/tui/internal/styles/background.go
index 144ee819d..99b05b456 100644
--- a/packages/tui/internal/styles/background.go
+++ b/packages/tui/internal/styles/background.go
@@ -1,6 +1,9 @@
package styles
+import "image/color"
+
type TerminalInfo struct {
+ Background color.Color
BackgroundIsDark bool
}
@@ -8,6 +11,7 @@ var Terminal *TerminalInfo
func init() {
Terminal = &TerminalInfo{
+ Background: color.Black,
BackgroundIsDark: true,
}
}
diff --git a/packages/tui/internal/styles/markdown.go b/packages/tui/internal/styles/markdown.go
index f28e26793..14db75466 100644
--- a/packages/tui/internal/styles/markdown.go
+++ b/packages/tui/internal/styles/markdown.go
@@ -3,6 +3,7 @@ package styles
import (
"github.com/charmbracelet/glamour"
"github.com/charmbracelet/glamour/ansi"
+ "github.com/charmbracelet/lipgloss/v2"
"github.com/charmbracelet/lipgloss/v2/compat"
"github.com/lucasb-eyer/go-colorful"
"github.com/sst/opencode/internal/theme"
@@ -29,7 +30,7 @@ func GetMarkdownRenderer(width int, backgroundColor compat.AdaptiveColor) *glamo
// using adaptive colors from the provided theme.
func generateMarkdownStyleConfig(backgroundColor compat.AdaptiveColor) ansi.StyleConfig {
t := theme.CurrentTheme()
- background := stringPtr(AdaptiveColorToString(backgroundColor))
+ background := AdaptiveColorToString(backgroundColor)
return ansi.StyleConfig{
Document: ansi.StyleBlock{
@@ -37,12 +38,12 @@ func generateMarkdownStyleConfig(backgroundColor compat.AdaptiveColor) ansi.Styl
BlockPrefix: "",
BlockSuffix: "",
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.MarkdownText())),
+ Color: AdaptiveColorToString(t.MarkdownText()),
},
},
BlockQuote: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
- Color: stringPtr(AdaptiveColorToString(t.MarkdownBlockQuote())),
+ Color: AdaptiveColorToString(t.MarkdownBlockQuote()),
Italic: boolPtr(true),
Prefix: "┃ ",
},
@@ -54,108 +55,108 @@ func generateMarkdownStyleConfig(backgroundColor compat.AdaptiveColor) ansi.Styl
StyleBlock: ansi.StyleBlock{
IndentToken: stringPtr(" "),
StylePrimitive: ansi.StylePrimitive{
- Color: stringPtr(AdaptiveColorToString(t.MarkdownText())),
+ Color: AdaptiveColorToString(t.MarkdownText()),
},
},
},
Heading: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
BlockSuffix: "\n",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownHeading())),
+ Color: AdaptiveColorToString(t.MarkdownHeading()),
Bold: boolPtr(true),
},
},
H1: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
Prefix: "# ",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownHeading())),
+ Color: AdaptiveColorToString(t.MarkdownHeading()),
Bold: boolPtr(true),
},
},
H2: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
Prefix: "## ",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownHeading())),
+ Color: AdaptiveColorToString(t.MarkdownHeading()),
Bold: boolPtr(true),
},
},
H3: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
Prefix: "### ",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownHeading())),
+ Color: AdaptiveColorToString(t.MarkdownHeading()),
Bold: boolPtr(true),
},
},
H4: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
Prefix: "#### ",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownHeading())),
+ Color: AdaptiveColorToString(t.MarkdownHeading()),
Bold: boolPtr(true),
},
},
H5: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
Prefix: "##### ",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownHeading())),
+ Color: AdaptiveColorToString(t.MarkdownHeading()),
Bold: boolPtr(true),
},
},
H6: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
Prefix: "###### ",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownHeading())),
+ Color: AdaptiveColorToString(t.MarkdownHeading()),
Bold: boolPtr(true),
},
},
Strikethrough: ansi.StylePrimitive{
CrossedOut: boolPtr(true),
- Color: stringPtr(AdaptiveColorToString(t.TextMuted())),
+ Color: AdaptiveColorToString(t.TextMuted()),
},
Emph: ansi.StylePrimitive{
- Color: stringPtr(AdaptiveColorToString(t.MarkdownEmph())),
+ Color: AdaptiveColorToString(t.MarkdownEmph()),
Italic: boolPtr(true),
},
Strong: ansi.StylePrimitive{
Bold: boolPtr(true),
- Color: stringPtr(AdaptiveColorToString(t.MarkdownStrong())),
+ Color: AdaptiveColorToString(t.MarkdownStrong()),
},
HorizontalRule: ansi.StylePrimitive{
- Color: stringPtr(AdaptiveColorToString(t.MarkdownHorizontalRule())),
+ Color: AdaptiveColorToString(t.MarkdownHorizontalRule()),
Format: "\n─────────────────────────────────────────\n",
},
Item: ansi.StylePrimitive{
BlockPrefix: "• ",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownListItem())),
+ Color: AdaptiveColorToString(t.MarkdownListItem()),
},
Enumeration: ansi.StylePrimitive{
BlockPrefix: ". ",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownListEnumeration())),
+ Color: AdaptiveColorToString(t.MarkdownListEnumeration()),
},
Task: ansi.StyleTask{
Ticked: "[✓] ",
Unticked: "[ ] ",
},
Link: ansi.StylePrimitive{
- Color: stringPtr(AdaptiveColorToString(t.MarkdownLink())),
+ Color: AdaptiveColorToString(t.MarkdownLink()),
Underline: boolPtr(true),
},
LinkText: ansi.StylePrimitive{
- Color: stringPtr(AdaptiveColorToString(t.MarkdownLinkText())),
+ Color: AdaptiveColorToString(t.MarkdownLinkText()),
Bold: boolPtr(true),
},
Image: ansi.StylePrimitive{
- Color: stringPtr(AdaptiveColorToString(t.MarkdownImage())),
+ Color: AdaptiveColorToString(t.MarkdownImage()),
Underline: boolPtr(true),
Format: "🖼 {{.text}}",
},
ImageText: ansi.StylePrimitive{
- Color: stringPtr(AdaptiveColorToString(t.MarkdownImageText())),
+ Color: AdaptiveColorToString(t.MarkdownImageText()),
Format: "{{.text}}",
},
Code: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.MarkdownCode())),
+ Color: AdaptiveColorToString(t.MarkdownCode()),
Prefix: "",
Suffix: "",
},
@@ -165,7 +166,7 @@ func generateMarkdownStyleConfig(backgroundColor compat.AdaptiveColor) ansi.Styl
StylePrimitive: ansi.StylePrimitive{
BackgroundColor: background,
Prefix: " ",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownCodeBlock())),
+ Color: AdaptiveColorToString(t.MarkdownCodeBlock()),
},
},
Chroma: &ansi.Chroma{
@@ -174,109 +175,109 @@ func generateMarkdownStyleConfig(backgroundColor compat.AdaptiveColor) ansi.Styl
},
Text: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.MarkdownText())),
+ Color: AdaptiveColorToString(t.MarkdownText()),
},
Error: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.Error())),
+ Color: AdaptiveColorToString(t.Error()),
},
Comment: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxComment())),
+ Color: AdaptiveColorToString(t.SyntaxComment()),
},
CommentPreproc: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxKeyword())),
+ Color: AdaptiveColorToString(t.SyntaxKeyword()),
},
Keyword: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxKeyword())),
+ Color: AdaptiveColorToString(t.SyntaxKeyword()),
},
KeywordReserved: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxKeyword())),
+ Color: AdaptiveColorToString(t.SyntaxKeyword()),
},
KeywordNamespace: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxKeyword())),
+ Color: AdaptiveColorToString(t.SyntaxKeyword()),
},
KeywordType: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxType())),
+ Color: AdaptiveColorToString(t.SyntaxType()),
},
Operator: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxOperator())),
+ Color: AdaptiveColorToString(t.SyntaxOperator()),
},
Punctuation: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxPunctuation())),
+ Color: AdaptiveColorToString(t.SyntaxPunctuation()),
},
Name: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxVariable())),
+ Color: AdaptiveColorToString(t.SyntaxVariable()),
},
NameBuiltin: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxVariable())),
+ Color: AdaptiveColorToString(t.SyntaxVariable()),
},
NameTag: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxKeyword())),
+ Color: AdaptiveColorToString(t.SyntaxKeyword()),
},
NameAttribute: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxFunction())),
+ Color: AdaptiveColorToString(t.SyntaxFunction()),
},
NameClass: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxType())),
+ Color: AdaptiveColorToString(t.SyntaxType()),
},
NameConstant: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxVariable())),
+ Color: AdaptiveColorToString(t.SyntaxVariable()),
},
NameDecorator: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxFunction())),
+ Color: AdaptiveColorToString(t.SyntaxFunction()),
},
NameFunction: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxFunction())),
+ Color: AdaptiveColorToString(t.SyntaxFunction()),
},
LiteralNumber: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxNumber())),
+ Color: AdaptiveColorToString(t.SyntaxNumber()),
},
LiteralString: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxString())),
+ Color: AdaptiveColorToString(t.SyntaxString()),
},
LiteralStringEscape: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.SyntaxKeyword())),
+ Color: AdaptiveColorToString(t.SyntaxKeyword()),
},
GenericDeleted: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.DiffRemoved())),
+ Color: AdaptiveColorToString(t.DiffRemoved()),
},
GenericEmph: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.MarkdownEmph())),
+ Color: AdaptiveColorToString(t.MarkdownEmph()),
Italic: boolPtr(true),
},
GenericInserted: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.DiffAdded())),
+ Color: AdaptiveColorToString(t.DiffAdded()),
},
GenericStrong: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.MarkdownStrong())),
+ Color: AdaptiveColorToString(t.MarkdownStrong()),
Bold: boolPtr(true),
},
GenericSubheading: ansi.StylePrimitive{
BackgroundColor: background,
- Color: stringPtr(AdaptiveColorToString(t.MarkdownHeading())),
+ Color: AdaptiveColorToString(t.MarkdownHeading()),
},
},
},
@@ -293,14 +294,14 @@ func generateMarkdownStyleConfig(backgroundColor compat.AdaptiveColor) ansi.Styl
},
DefinitionDescription: ansi.StylePrimitive{
BlockPrefix: "\n ❯ ",
- Color: stringPtr(AdaptiveColorToString(t.MarkdownLinkText())),
+ Color: AdaptiveColorToString(t.MarkdownLinkText()),
},
Text: ansi.StylePrimitive{
- Color: stringPtr(AdaptiveColorToString(t.MarkdownText())),
+ Color: AdaptiveColorToString(t.MarkdownText()),
},
Paragraph: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
- Color: stringPtr(AdaptiveColorToString(t.MarkdownText())),
+ Color: AdaptiveColorToString(t.MarkdownText()),
},
},
}
@@ -308,11 +309,17 @@ func generateMarkdownStyleConfig(backgroundColor compat.AdaptiveColor) ansi.Styl
// AdaptiveColorToString converts a compat.AdaptiveColor to the appropriate
// hex color string based on the current terminal background
-func AdaptiveColorToString(color compat.AdaptiveColor) string {
+func AdaptiveColorToString(color compat.AdaptiveColor) *string {
if Terminal.BackgroundIsDark {
+ if _, ok := color.Dark.(lipgloss.NoColor); ok {
+ return nil
+ }
c1, _ := colorful.MakeColor(color.Dark)
- return c1.Hex()
+ return stringPtr(c1.Hex())
+ }
+ if _, ok := color.Light.(lipgloss.NoColor); ok {
+ return nil
}
c1, _ := colorful.MakeColor(color.Light)
- return c1.Hex()
+ return stringPtr(c1.Hex())
}
diff --git a/packages/tui/internal/styles/styles.go b/packages/tui/internal/styles/styles.go
index 733fce55c..b8905f8e4 100644
--- a/packages/tui/internal/styles/styles.go
+++ b/packages/tui/internal/styles/styles.go
@@ -3,155 +3,8 @@ package styles
import (
"github.com/charmbracelet/lipgloss/v2"
"github.com/charmbracelet/lipgloss/v2/compat"
- "github.com/sst/opencode/internal/theme"
)
-// BaseStyle returns the base style with background and foreground colors
-func BaseStyle() lipgloss.Style {
- t := theme.CurrentTheme()
- return lipgloss.NewStyle().Foreground(t.Text())
-}
-
-func Panel() lipgloss.Style {
- t := theme.CurrentTheme()
- return lipgloss.NewStyle().
- Background(t.BackgroundPanel()).
- Border(lipgloss.NormalBorder(), true, false, true, false).
- BorderForeground(t.BorderSubtle()).
- Foreground(t.Text())
-}
-
-// Regular returns a basic unstyled lipgloss.Style
-func Regular() lipgloss.Style {
- return lipgloss.NewStyle()
-}
-
-func Muted() lipgloss.Style {
- t := theme.CurrentTheme()
- return lipgloss.NewStyle().Foreground(t.TextMuted())
-}
-
-// Bold returns a bold style
-func Bold() lipgloss.Style {
- return BaseStyle().Bold(true)
-}
-
-// Padded returns a style with horizontal padding
-func Padded() lipgloss.Style {
- return BaseStyle().Padding(0, 1)
-}
-
-// Border returns a style with a normal border
-func Border() lipgloss.Style {
- t := theme.CurrentTheme()
- return Regular().
- Border(lipgloss.NormalBorder()).
- BorderForeground(t.Border())
-}
-
-// ThickBorder returns a style with a thick border
-func ThickBorder() lipgloss.Style {
- t := theme.CurrentTheme()
- return Regular().
- Border(lipgloss.ThickBorder()).
- BorderForeground(t.Border())
-}
-
-// DoubleBorder returns a style with a double border
-func DoubleBorder() lipgloss.Style {
- t := theme.CurrentTheme()
- return Regular().
- Border(lipgloss.DoubleBorder()).
- BorderForeground(t.Border())
-}
-
-// FocusedBorder returns a style with a border using the focused border color
-func FocusedBorder() lipgloss.Style {
- t := theme.CurrentTheme()
- return Regular().
- Border(lipgloss.NormalBorder()).
- BorderForeground(t.BorderActive())
-}
-
-// DimBorder returns a style with a border using the dim border color
-func DimBorder() lipgloss.Style {
- t := theme.CurrentTheme()
- return Regular().
- Border(lipgloss.NormalBorder()).
- BorderForeground(t.BorderSubtle())
-}
-
-// PrimaryColor returns the primary color from the current theme
-func PrimaryColor() compat.AdaptiveColor {
- return theme.CurrentTheme().Primary()
-}
-
-// SecondaryColor returns the secondary color from the current theme
-func SecondaryColor() compat.AdaptiveColor {
- return theme.CurrentTheme().Secondary()
-}
-
-// AccentColor returns the accent color from the current theme
-func AccentColor() compat.AdaptiveColor {
- return theme.CurrentTheme().Accent()
-}
-
-// ErrorColor returns the error color from the current theme
-func ErrorColor() compat.AdaptiveColor {
- return theme.CurrentTheme().Error()
-}
-
-// WarningColor returns the warning color from the current theme
-func WarningColor() compat.AdaptiveColor {
- return theme.CurrentTheme().Warning()
-}
-
-// SuccessColor returns the success color from the current theme
-func SuccessColor() compat.AdaptiveColor {
- return theme.CurrentTheme().Success()
-}
-
-// InfoColor returns the info color from the current theme
-func InfoColor() compat.AdaptiveColor {
- return theme.CurrentTheme().Info()
-}
-
-// TextColor returns the text color from the current theme
-func TextColor() compat.AdaptiveColor {
- return theme.CurrentTheme().Text()
-}
-
-// TextMutedColor returns the muted text color from the current theme
-func TextMutedColor() compat.AdaptiveColor {
- return theme.CurrentTheme().TextMuted()
-}
-
-// BackgroundColor returns the background color from the current theme
-func BackgroundColor() compat.AdaptiveColor {
- return theme.CurrentTheme().Background()
-}
-
-// BackgroundPanelColor returns the subtle background color from the current theme
-func BackgroundPanelColor() compat.AdaptiveColor {
- return theme.CurrentTheme().BackgroundPanel()
-}
-
-// BackgroundElementColor returns the darker background color from the current theme
-func BackgroundElementColor() compat.AdaptiveColor {
- return theme.CurrentTheme().BackgroundElement()
-}
-
-// BorderColor returns the border color from the current theme
-func BorderColor() compat.AdaptiveColor {
- return theme.CurrentTheme().Border()
-}
-
-// BorderActiveColor returns the active border color from the current theme
-func BorderActiveColor() compat.AdaptiveColor {
- return theme.CurrentTheme().BorderActive()
-}
-
-// BorderSubtleColor returns the subtle border color from the current theme
-func BorderSubtleColor() compat.AdaptiveColor {
- return theme.CurrentTheme().BorderSubtle()
+func WhitespaceStyle(bg compat.AdaptiveColor) lipgloss.WhitespaceOption {
+ return lipgloss.WithWhitespaceStyle(NewStyle().Background(bg).Lipgloss())
}
diff --git a/packages/tui/internal/styles/utilities.go b/packages/tui/internal/styles/utilities.go
new file mode 100644
index 000000000..29d10f5c5
--- /dev/null
+++ b/packages/tui/internal/styles/utilities.go
@@ -0,0 +1,295 @@
+package styles
+
+import (
+ "image/color"
+
+ "github.com/charmbracelet/lipgloss/v2"
+ "github.com/charmbracelet/lipgloss/v2/compat"
+)
+
+// IsNoColor checks if a color is the special NoColor type
+func IsNoColor(c color.Color) bool {
+ _, ok := c.(lipgloss.NoColor)
+ return ok
+}
+
+// Style wraps lipgloss.Style to provide a fluent API for handling "none" colors
+type Style struct {
+ lipgloss.Style
+}
+
+// NewStyle creates a new Style with proper handling of "none" colors
+func NewStyle() Style {
+ return Style{lipgloss.NewStyle()}
+}
+
+func (s Style) Lipgloss() lipgloss.Style {
+ return s.Style
+}
+
+// Foreground sets the foreground color, handling "none" appropriately
+func (s Style) Foreground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetForeground()}
+ }
+ return Style{s.Style.Foreground(c)}
+}
+
+// Background sets the background color, handling "none" appropriately
+func (s Style) Background(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBackground()}
+ }
+ return Style{s.Style.Background(c)}
+}
+
+// BorderForeground sets the border foreground color, handling "none" appropriately
+func (s Style) BorderForeground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBorderForeground()}
+ }
+ return Style{s.Style.BorderForeground(c)}
+}
+
+// BorderBackground sets the border background color, handling "none" appropriately
+func (s Style) BorderBackground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBorderBackground()}
+ }
+ return Style{s.Style.BorderBackground(c)}
+}
+
+// BorderTopForeground sets the border top foreground color, handling "none" appropriately
+func (s Style) BorderTopForeground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBorderTopForeground()}
+ }
+ return Style{s.Style.BorderTopForeground(c)}
+}
+
+// BorderTopBackground sets the border top background color, handling "none" appropriately
+func (s Style) BorderTopBackground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBorderTopBackground()}
+ }
+ return Style{s.Style.BorderTopBackground(c)}
+}
+
+// BorderBottomForeground sets the border bottom foreground color, handling "none" appropriately
+func (s Style) BorderBottomForeground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBorderBottomForeground()}
+ }
+ return Style{s.Style.BorderBottomForeground(c)}
+}
+
+// BorderBottomBackground sets the border bottom background color, handling "none" appropriately
+func (s Style) BorderBottomBackground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBorderBottomBackground()}
+ }
+ return Style{s.Style.BorderBottomBackground(c)}
+}
+
+// BorderLeftForeground sets the border left foreground color, handling "none" appropriately
+func (s Style) BorderLeftForeground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBorderLeftForeground()}
+ }
+ return Style{s.Style.BorderLeftForeground(c)}
+}
+
+// BorderLeftBackground sets the border left background color, handling "none" appropriately
+func (s Style) BorderLeftBackground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBorderLeftBackground()}
+ }
+ return Style{s.Style.BorderLeftBackground(c)}
+}
+
+// BorderRightForeground sets the border right foreground color, handling "none" appropriately
+func (s Style) BorderRightForeground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBorderRightForeground()}
+ }
+ return Style{s.Style.BorderRightForeground(c)}
+}
+
+// BorderRightBackground sets the border right background color, handling "none" appropriately
+func (s Style) BorderRightBackground(c compat.AdaptiveColor) Style {
+ if IsNoColor(c.Dark) && IsNoColor(c.Light) {
+ return Style{s.Style.UnsetBorderRightBackground()}
+ }
+ return Style{s.Style.BorderRightBackground(c)}
+}
+
+// Render applies the style to a string
+func (s Style) Render(str string) string {
+ return s.Style.Render(str)
+}
+
+// Common lipgloss.Style method delegations for seamless usage
+
+func (s Style) Bold(v bool) Style {
+ return Style{s.Style.Bold(v)}
+}
+
+func (s Style) Italic(v bool) Style {
+ return Style{s.Style.Italic(v)}
+}
+
+func (s Style) Underline(v bool) Style {
+ return Style{s.Style.Underline(v)}
+}
+
+func (s Style) Strikethrough(v bool) Style {
+ return Style{s.Style.Strikethrough(v)}
+}
+
+func (s Style) Blink(v bool) Style {
+ return Style{s.Style.Blink(v)}
+}
+
+func (s Style) Faint(v bool) Style {
+ return Style{s.Style.Faint(v)}
+}
+
+func (s Style) Reverse(v bool) Style {
+ return Style{s.Style.Reverse(v)}
+}
+
+func (s Style) Width(i int) Style {
+ return Style{s.Style.Width(i)}
+}
+
+func (s Style) Height(i int) Style {
+ return Style{s.Style.Height(i)}
+}
+
+func (s Style) Padding(i ...int) Style {
+ return Style{s.Style.Padding(i...)}
+}
+
+func (s Style) PaddingTop(i int) Style {
+ return Style{s.Style.PaddingTop(i)}
+}
+
+func (s Style) PaddingBottom(i int) Style {
+ return Style{s.Style.PaddingBottom(i)}
+}
+
+func (s Style) PaddingLeft(i int) Style {
+ return Style{s.Style.PaddingLeft(i)}
+}
+
+func (s Style) PaddingRight(i int) Style {
+ return Style{s.Style.PaddingRight(i)}
+}
+
+func (s Style) Margin(i ...int) Style {
+ return Style{s.Style.Margin(i...)}
+}
+
+func (s Style) MarginTop(i int) Style {
+ return Style{s.Style.MarginTop(i)}
+}
+
+func (s Style) MarginBottom(i int) Style {
+ return Style{s.Style.MarginBottom(i)}
+}
+
+func (s Style) MarginLeft(i int) Style {
+ return Style{s.Style.MarginLeft(i)}
+}
+
+func (s Style) MarginRight(i int) Style {
+ return Style{s.Style.MarginRight(i)}
+}
+
+func (s Style) Border(b lipgloss.Border, sides ...bool) Style {
+ return Style{s.Style.Border(b, sides...)}
+}
+
+func (s Style) BorderStyle(b lipgloss.Border) Style {
+ return Style{s.Style.BorderStyle(b)}
+}
+
+func (s Style) BorderTop(v bool) Style {
+ return Style{s.Style.BorderTop(v)}
+}
+
+func (s Style) BorderBottom(v bool) Style {
+ return Style{s.Style.BorderBottom(v)}
+}
+
+func (s Style) BorderLeft(v bool) Style {
+ return Style{s.Style.BorderLeft(v)}
+}
+
+func (s Style) BorderRight(v bool) Style {
+ return Style{s.Style.BorderRight(v)}
+}
+
+func (s Style) Align(p ...lipgloss.Position) Style {
+ return Style{s.Style.Align(p...)}
+}
+
+func (s Style) AlignHorizontal(p lipgloss.Position) Style {
+ return Style{s.Style.AlignHorizontal(p)}
+}
+
+func (s Style) AlignVertical(p lipgloss.Position) Style {
+ return Style{s.Style.AlignVertical(p)}
+}
+
+func (s Style) Inline(v bool) Style {
+ return Style{s.Style.Inline(v)}
+}
+
+func (s Style) MaxWidth(n int) Style {
+ return Style{s.Style.MaxWidth(n)}
+}
+
+func (s Style) MaxHeight(n int) Style {
+ return Style{s.Style.MaxHeight(n)}
+}
+
+func (s Style) TabWidth(n int) Style {
+ return Style{s.Style.TabWidth(n)}
+}
+
+func (s Style) UnsetBold() Style {
+ return Style{s.Style.UnsetBold()}
+}
+
+func (s Style) UnsetItalic() Style {
+ return Style{s.Style.UnsetItalic()}
+}
+
+func (s Style) UnsetUnderline() Style {
+ return Style{s.Style.UnsetUnderline()}
+}
+
+func (s Style) UnsetStrikethrough() Style {
+ return Style{s.Style.UnsetStrikethrough()}
+}
+
+func (s Style) UnsetBlink() Style {
+ return Style{s.Style.UnsetBlink()}
+}
+
+func (s Style) UnsetFaint() Style {
+ return Style{s.Style.UnsetFaint()}
+}
+
+func (s Style) UnsetReverse() Style {
+ return Style{s.Style.UnsetReverse()}
+}
+
+func (s Style) Copy() Style {
+ return Style{s.Style}
+}
+
+func (s Style) Inherit(i Style) Style {
+ return Style{s.Style.Inherit(i.Style)}
+}