-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathShowcase.fsx
214 lines (174 loc) Β· 6.97 KB
/
Showcase.fsx
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#r "nuget: Spectre.Console, 0.46.0"
#r "src/FsSpectre/bin/Debug/netstandard2.0/FsSpectre.dll"
open System
open Spectre.Console
open FsSpectre
let generateException () =
try
raise (InvalidOperationException("This is invalid!"))
with ex ->
ex
table {
title_text "[u][yellow]Spectre.Console[/] [b]Features[/][/]"
column (
tableColumn {
header_text "Feature"
no_wrap
right_aligned
width 10
pad_right 3
}
)
column (
tableColumn {
header_text "Demonstration"
pad_right 0
}
)
empty_row
row
[| markup { text "[red]Colors[/]" }
table {
collapse
no_headers
no_border
column (
tableColumn {
header_text "Desc"
pad_right 3
}
)
column (
tableColumn {
header_text "Colors"
pad_right 0
}
)
row
[| markup {
text (
"β [bold grey]NO_COLOR support[/]\n"
+ "β [bold green]3-bit color[/]\n"
+ "β [bold blue]4-bit color[/]\n"
+ "β [bold purple]8-bit color[/]\n"
+ "β [bold yellow]Truecolor (16.7 million)[/]\n"
+ "β [bold aqua]Automatic color conversion[/]"
)
}
ColorBox(6) |]
} |]
empty_row
row
[| markup { text "[red]OS[/]" }
grid {
expand
number_of_columns 3
row_text [| "[bold green]Windows[/]"; "[bold blue]macOS[/]"; "[bold yellow]Linux[/]" |]
} |]
empty_row
row_text
[| "[red]Styles[/]"
"All ansi styles: [bold]bold[/], [dim]dim[/], [italic]italic[/], [underline]underline[/], [strikethrough]strikethrough[/], [reverse]reverse[/], and even [blink]blink[/]." |]
empty_row
row
[| markup { text "[red]Text[/]" }
markup { text "Word wrap text. Justify [green]left[/], [yellow]center[/] or [blue]right[/]." } |]
empty_row
row
[| text { empty }
grid {
column (gridColumn { left_aligned })
column (gridColumn { centerd })
column (gridColumn { right_aligned })
row_text
[| "[green]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque in metus sed sapien ultricies pretium a at justo. Maecenas luctus velit et auctor maximus.[/]"
"[yellow]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque in metus sed sapien ultricies pretium a at justo. Maecenas luctus velit et auctor maximus.[/]"
"[blue]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque in metus sed sapien ultricies pretium a at justo. Maecenas luctus velit et auctor maximus.[/]" |]
} |]
empty_row
row
[| markup { text "[red]Markup[/]" }
markup {
text
"[bold purple]Spectre.Console[/] supports a simple [i]bbcode[/] like [b]markup[/] for [yellow]color[/], [underline]style[/], and emoji! :thumbs_up: :red_apple: :ant: :bear: :baguette_bread: :bus:"
} |]
empty_row
row
[| markup { text "[red]Tables and Trees[/]" }
table {
rounded_border
collapse
border_color Color.Yellow
columns_text [| "Foo"; "Bar" |]
row
[| text { text "Baz" }
table {
simple_border
border_color Color.Grey
columns
[| tableColumn { header_text "Overview" }
tableColumn { footer_text "[grey]3 Files, 225 KiB[/]" } |]
row
[| markup { text "[yellow]Files[/]" }
tree {
label "π src"
node (
treeNode {
label "π foo"
node (treeNode { label "π bar.cs" })
}
)
node (
treeNode {
label "π baz"
node (
treeNode {
label "π qux"
node (treeNode { label "π corgi.txt" })
}
)
}
)
node (treeNode { label "π waldo.xml" })
} |]
} |]
row_text [| "Qux"; "Corgi" |]
} |]
empty_row
row
[| markup { text "[red]Tables and Trees[/]" }
grid {
number_of_columns 2
row
[| panel {
border_color Color.Grey
content_renderable (
breakdownChart {
show_percentage
full_size
item ("F#", 82, Color.Violet)
item ("PowerShell", 13, Color.Red)
item ("Bash", 5, Color.Blue)
}
)
}
panel {
border_color Color.Grey
content_renderable (
barChart {
item ("Apple", 32, Color.Green)
item ("Oranges", 13, Color.Orange1)
item ("Bananas", 22, Color.Yellow)
}
)
} |]
} |]
empty_row
row [| markup { text "[red]Exceptions[/]" }; generateException().GetRenderable() |]
empty_row
row_text
[| "[red]+ Much more![/]"
"Tables, Grids, Trees, Progress bars, Status, Bar charts, Calendars, Figlet, Images, Text prompts, List boxes, Separators, Pretty exceptions, Canvas, CLI parsing" |]
empty_row
}
|> AnsiConsole.Write