2022-07-13 15:55:36 +02:00
|
|
|
package style
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/charmbracelet/lipgloss"
|
2022-08-05 00:45:19 +02:00
|
|
|
|
|
|
|
"github.com/charmbracelet/gum/internal/decode"
|
2022-07-13 15:55:36 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// ToLipgloss takes a Styles flag set and returns the corresponding
|
|
|
|
// lipgloss.Style.
|
|
|
|
func (s Styles) ToLipgloss() lipgloss.Style {
|
|
|
|
return lipgloss.NewStyle().
|
|
|
|
Background(lipgloss.Color(s.Background)).
|
|
|
|
Foreground(lipgloss.Color(s.Foreground)).
|
|
|
|
BorderBackground(lipgloss.Color(s.BorderBackground)).
|
|
|
|
BorderForeground(lipgloss.Color(s.BorderForeground)).
|
|
|
|
Align(decode.Align[s.Align]).
|
|
|
|
Border(border[s.Border]).
|
|
|
|
Height(s.Height).
|
|
|
|
Width(s.Width).
|
|
|
|
Margin(parseMargin(s.Margin)).
|
|
|
|
Padding(parsePadding(s.Padding)).
|
|
|
|
Bold(s.Bold).
|
|
|
|
Faint(s.Faint).
|
|
|
|
Italic(s.Italic).
|
2022-07-26 21:43:26 +02:00
|
|
|
Strikethrough(s.Strikethrough).
|
|
|
|
Underline(s.Underline)
|
2022-07-13 15:55:36 +02:00
|
|
|
}
|