2022-07-13 16:55:36 +03:00
|
|
|
package style
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/charmbracelet/lipgloss"
|
2022-08-05 01:45:19 +03:00
|
|
|
|
|
|
|
"github.com/charmbracelet/gum/internal/decode"
|
2022-07-13 16:55:36 +03: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]).
|
2023-10-16 17:51:31 +03:00
|
|
|
Border(Border[s.Border]).
|
2022-07-13 16:55:36 +03:00
|
|
|
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 22:43:26 +03:00
|
|
|
Strikethrough(s.Strikethrough).
|
|
|
|
Underline(s.Underline)
|
2022-07-13 16:55:36 +03:00
|
|
|
}
|