mirror of
https://github.com/charmbracelet/gum
synced 2024-06-09 01:02:17 +02:00
09feddcc61
Style provides a shell script interface for Lip Gloss. It allows you to use Lip Gloss to style text without needing to use Go. All of the styling options are available as flags. Let's make some text glamorous using bash: ``` gum style \ --foreground "#FF06B7" --border "double" \ --margin 2 --padding "2 4" --width 50 \ "And oh gosh, how delicious the fabulous frizzy frobscottle" \ "was! It was sweet and refreshing. It tasted of vanilla and" \ "cream, with just the faintest trace of raspberries on the" \ "edge of the flavour. And the bubbles were wonderful." ``` Output: ``` ╔══════════════════════════════════════════════════╗ ║ ║ ║ ║ ║ And oh gosh, how delicious the fabulous ║ ║ frizzy frobscottle was It was sweet and ║ ║ refreshing. It tasted of vanilla and ║ ║ cream, with just the faintest trace of ║ ║ raspberries on the edge of the flavour. ║ ║ And the bubbles were wonderful. ║ ║ ║ ║ ║ ╚══════════════════════════════════════════════════╝ ```
22 lines
1 KiB
Go
22 lines
1 KiB
Go
package style
|
|
|
|
// Options is the customization options for the style command.
|
|
type Options struct {
|
|
Text string `arg:"" optional:"" help:"Text to style"`
|
|
|
|
Background string `help:"Background color"`
|
|
Foreground string `help:"Foreground color"`
|
|
BorderBackground string `help:"Border background color"`
|
|
BorderForeground string `help:"Border foreground color"`
|
|
Align string `help:"Text alignment" enum:"left,center,right,bottom,middle,top" default:"left"`
|
|
Border string `help:"Border style to apply" enum:"none,hidden,normal,rounded,thick,double" default:"none"`
|
|
Height int `help:"Height of output"`
|
|
Width int `help:"Width of output"`
|
|
Margin string `help:"Margin to apply around the text."`
|
|
Padding string `help:"Padding to apply around the text."`
|
|
Bold bool `help:"Apply bold formatting"`
|
|
Faint bool `help:"Apply faint formatting"`
|
|
Italic bool `help:"Apply italic formatting"`
|
|
Strikethrough bool `help:"Apply strikethrough formatting"`
|
|
}
|