| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package config
- import "github.com/rivo/tview"
- type BorderPreset struct {
- Horizontal rune
- Vertical rune
- TopLeft rune
- TopRight rune
- BottomLeft rune
- BottomRight rune
- }
- func (p *BorderPreset) UnmarshalTOML(v any) error {
- switch v.(string) {
- case "double":
- *p = borderPresetDouble()
- case "thick":
- *p = borderPresetThick()
- case "round":
- *p = borderPresetRound()
- case "hidden":
- *p = BorderPreset{
- Horizontal: ' ',
- Vertical: ' ',
- TopLeft: ' ',
- TopRight: ' ',
- BottomLeft: ' ',
- BottomRight: ' ',
- }
- }
- return nil
- }
- func borderPresetDouble() BorderPreset {
- return BorderPreset{
- Horizontal: tview.BoxDrawingsDoubleHorizontal,
- Vertical: tview.BoxDrawingsDoubleVertical,
- TopLeft: tview.BoxDrawingsDoubleDownAndRight,
- TopRight: tview.BoxDrawingsDoubleDownAndLeft,
- BottomLeft: tview.BoxDrawingsDoubleUpAndRight,
- BottomRight: tview.BoxDrawingsDoubleUpAndLeft,
- }
- }
- func borderPresetThick() BorderPreset {
- return BorderPreset{
- Horizontal: tview.BoxDrawingsHeavyHorizontal,
- Vertical: tview.BoxDrawingsHeavyVertical,
- TopLeft: tview.BoxDrawingsHeavyDownAndRight,
- TopRight: tview.BoxDrawingsHeavyDownAndLeft,
- BottomLeft: tview.BoxDrawingsHeavyUpAndRight,
- BottomRight: tview.BoxDrawingsHeavyUpAndLeft,
- }
- }
- func borderPresetRound() BorderPreset {
- return BorderPreset{
- Horizontal: tview.BoxDrawingsLightHorizontal,
- Vertical: tview.BoxDrawingsLightVertical,
- TopLeft: tview.BoxDrawingsLightArcDownAndRight,
- TopRight: tview.BoxDrawingsLightArcDownAndLeft,
- BottomLeft: tview.BoxDrawingsLightArcUpAndRight,
- BottomRight: tview.BoxDrawingsLightArcUpAndLeft,
- }
- }
|