-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathtypes.go
More file actions
executable file
·197 lines (185 loc) · 4.66 KB
/
types.go
File metadata and controls
executable file
·197 lines (185 loc) · 4.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
package box
import (
"os"
"github.com/charmbracelet/colorprofile"
)
// BoxStyle defines a built‑in border style for a Box.
type BoxStyle string
const (
// Single is a box style with single-line borders.
Single BoxStyle = "Single"
// Double is a box style with double-line borders.
Double BoxStyle = "Double"
// Round is a box style with rounded corners.
Round BoxStyle = "Round"
// Bold is a box style with heavy lines.
Bold BoxStyle = "Bold"
// SingleDouble is a box style with single horizontal and double vertical lines.
SingleDouble BoxStyle = "SingleDouble"
// DoubleSingle is a box style with double horizontal and single vertical lines.
DoubleSingle BoxStyle = "DoubleSingle"
// Classic is a box style using plus and minus characters.
Classic BoxStyle = "Classic"
// Hidden is a box style with invisible borders.
Hidden BoxStyle = "Hidden"
// Block is a box style with solid block characters.
Block BoxStyle = "Block"
)
// AlignType represents the horizontal alignment of content inside the box.
type AlignType string
const (
// Center represents centered content alignment.
Center AlignType = "Center"
// Left represents left-aligned content.
Left AlignType = "Left"
// Right represents right-aligned content.
Right AlignType = "Right"
)
// TitlePosition represents the position of the title relative to the box.
type TitlePosition string
const (
// Inside places the title as the first lines inside the box.
Inside TitlePosition = "Inside"
// Top places the title on the top border of the box.
Top TitlePosition = "Top"
// Bottom places the title on the bottom border of the box.
Bottom TitlePosition = "Bottom"
)
// Standard and bright ANSI color name constants usable with Color,
// TitleColor, and ContentColor.
const (
Black = "Black"
Red = "Red"
Green = "Green"
Yellow = "Yellow"
Blue = "Blue"
Magenta = "Magenta"
Cyan = "Cyan"
White = "White"
BrightBlack = "BrightBlack"
HiBlack = "HiBlack"
BrightRed = "BrightRed"
HiRed = "HiRed"
BrightGreen = "BrightGreen"
HiGreen = "HiGreen"
BrightYellow = "BrightYellow"
HiYellow = "HiYellow"
BrightBlue = "BrightBlue"
HiBlue = "HiBlue"
BrightMagenta = "BrightMagenta"
HiMagenta = "HiMagenta"
BrightCyan = "BrightCyan"
HiCyan = "HiCyan"
BrightWhite = "BrightWhite"
HiWhite = "HiWhite"
)
var (
// boxes are inbuilt Box styles provided by the module
boxes = map[BoxStyle]Box{
Single: {
topRight: "┐",
topLeft: "┌",
bottomRight: "┘",
bottomLeft: "└",
horizontal: "─",
vertical: "│",
},
Double: {
topRight: "╗",
topLeft: "╔",
bottomRight: "╝",
bottomLeft: "╚",
horizontal: "═",
vertical: "║",
},
Round: {
topRight: "╮",
topLeft: "╭",
bottomRight: "╯",
bottomLeft: "╰",
horizontal: "─",
vertical: "│",
},
Bold: {
topRight: "┓",
topLeft: "┏",
bottomRight: "┛",
bottomLeft: "┗",
horizontal: "━",
vertical: "┃",
},
SingleDouble: {
topRight: "╖",
topLeft: "╓",
bottomRight: "╜",
bottomLeft: "╙",
horizontal: "─",
vertical: "║",
},
DoubleSingle: {
topRight: "╕",
topLeft: "╒",
bottomRight: "╛",
bottomLeft: "╘",
horizontal: "═",
vertical: "│",
},
Classic: {
topRight: "+",
topLeft: "+",
bottomRight: "+",
bottomLeft: "+",
horizontal: "-",
vertical: "|",
},
Hidden: {
topRight: "+",
topLeft: "+",
bottomRight: "+",
bottomLeft: "+",
horizontal: " ",
vertical: " ",
},
Block: {
topRight: "█",
topLeft: "█",
bottomRight: "█",
bottomLeft: "█",
horizontal: "█",
vertical: "█",
},
}
)
var (
// colorToHex maps color names to their hexadecimal codes.
// This includes both standard and bright ANSI colors.
colorToHex = map[string]string{
// Basic ANSI colors (0-7)
Black: "#000000",
Red: "#800000",
Green: "#008000",
Yellow: "#808000",
Blue: "#000080",
Magenta: "#800080",
Cyan: "#008080",
White: "#C0C0C0",
// Bright ANSI colors (8-15)
BrightBlack: "#808080",
HiBlack: "#808080",
BrightRed: "#FF0000",
HiRed: "#FF0000",
BrightGreen: "#00FF00",
HiGreen: "#00FF00",
BrightYellow: "#FFFF00",
HiYellow: "#FFFF00",
BrightBlue: "#0000FF",
HiBlue: "#0000FF",
BrightMagenta: "#FF00FF",
HiMagenta: "#FF00FF",
BrightCyan: "#00FFFF",
HiCyan: "#00FFFF",
BrightWhite: "#FFFFFF",
HiWhite: "#FFFFFF",
}
profile = colorprofile.Detect(os.Stdout, os.Environ())
)