|
1 |
| -colorio = IOContext(IOBuffer(), :color => true) |
2 |
| - |
3 |
| -print(colorio, styled"just a string") |
4 |
| -Base.escape_string(colorio, styled"just a string") |
5 |
| -print(colorio, styled"{red:with color}") |
6 |
| -print(colorio, styled"{face=$(Face(foreground=:red)):with color}") |
7 |
| -print(colorio, styled"{(foreground=red):with color}") |
8 |
| -show(colorio, MIME("text/plain"), styled"{red:with color}") |
9 |
| -show(colorio, MIME("text/html"), styled"{red:with color}") |
10 |
| -print(colorio, styled"{red:with color}"[1]) |
11 |
| -print(colorio, styled"{underline=(blue,curly):more styling}") |
12 |
| - |
13 |
| -convert(StyledStrings.SimpleColor, (r = 0x01, g = 0x02, b = 0x03)) |
14 |
| -convert(StyledStrings.SimpleColor, 0x010203) |
15 |
| -convert(StyledStrings.SimpleColor, :namedcolor) |
16 |
| -tryparse(StyledStrings.SimpleColor, "blue") |
17 |
| -parse(StyledStrings.SimpleColor, "#010203") |
18 |
| - |
19 |
| -StyledStrings.Face(nothing, nothing, nothing, nothing, nothing, |
20 |
| - nothing, nothing, nothing, nothing, [:default]) |
21 |
| -StyledStrings.Face(height=2) |
22 |
| -merge(StyledStrings.Face(inherit=:blue), StyledStrings.Face(foreground=:white)) |
23 |
| -StyledStrings.Face(height=2) == StyledStrings.Face(height=3) |
24 |
| - |
25 |
| -show(colorio, MIME("text/plain"), StyledStrings.Face(foreground=:green)) |
26 |
| -show(colorio, StyledStrings.Face(foreground=:green)) |
27 |
| - |
28 |
| -StyledStrings.getface() |
29 |
| -StyledStrings.getface(:red) |
30 |
| -StyledStrings.getface(styled"{red:red}", 1) |
31 |
| - |
32 |
| -StyledStrings.addface!(:_precompile => Face(font="precompile")) |
33 |
| -StyledStrings.loadface!(:_precompile => Face(inverse=true)) |
34 |
| -StyledStrings.loaduserfaces!(Dict{String, Any}("_precompile" => |
35 |
| - Dict{String, Any}("strikethough" => true))) |
36 |
| -StyledStrings.resetfaces!(:_precompile) |
37 |
| -StyledStrings.resetfaces!() |
38 |
| - |
39 |
| -StyledStrings.withfaces(:yellow => StyledStrings.Face(foreground=:red), :green => :blue) do |
40 |
| - println(colorio, styled"{yellow:red} and {green:blue} mixed make {magenta:purple}") |
| 1 | +using PrecompileTools: @compile_workload, @setup_workload |
| 2 | + |
| 3 | +@setup_workload begin |
| 4 | + @compile_workload begin |
| 5 | + colorio = IOContext(IOBuffer(), :color => true) |
| 6 | + |
| 7 | + print(colorio, styled"just a string") |
| 8 | + Base.escape_string(colorio, styled"just a string") |
| 9 | + print(colorio, styled"{red:with color}") |
| 10 | + print(colorio, styled"{face=$(Face(foreground=:red)):with color}") |
| 11 | + print(colorio, styled"{(foreground=red):with color}") |
| 12 | + show(colorio, MIME("text/plain"), styled"{red:with color}") |
| 13 | + show(colorio, MIME("text/html"), styled"{red:with color}") |
| 14 | + print(colorio, styled"{red:with color}"[1]) |
| 15 | + print(colorio, styled"{underline=(blue,curly):more styling}") |
| 16 | + |
| 17 | + convert(StyledStrings.SimpleColor, (r = 0x01, g = 0x02, b = 0x03)) |
| 18 | + convert(StyledStrings.SimpleColor, 0x010203) |
| 19 | + convert(StyledStrings.SimpleColor, :namedcolor) |
| 20 | + tryparse(StyledStrings.SimpleColor, "blue") |
| 21 | + parse(StyledStrings.SimpleColor, "#010203") |
| 22 | + |
| 23 | + StyledStrings.Face(nothing, nothing, nothing, nothing, nothing, |
| 24 | + nothing, nothing, nothing, nothing, [:default]) |
| 25 | + StyledStrings.Face(height=2) |
| 26 | + merge(StyledStrings.Face(inherit=:blue), StyledStrings.Face(foreground=:white)) |
| 27 | + StyledStrings.Face(height=2) == StyledStrings.Face(height=3) |
| 28 | + |
| 29 | + show(colorio, MIME("text/plain"), StyledStrings.Face(foreground=:green)) |
| 30 | + show(colorio, StyledStrings.Face(foreground=:green)) |
| 31 | + |
| 32 | + StyledStrings.getface() |
| 33 | + StyledStrings.getface(:red) |
| 34 | + StyledStrings.getface(styled"{red:red}", 1) |
| 35 | + |
| 36 | + StyledStrings.addface!(:_precompile => Face(font="precompile")) |
| 37 | + StyledStrings.loadface!(:_precompile => Face(inverse=true)) |
| 38 | + StyledStrings.loaduserfaces!(Dict{String, Any}("_precompile" => |
| 39 | + Dict{String, Any}("strikethough" => true))) |
| 40 | + StyledStrings.resetfaces!(:_precompile) |
| 41 | + StyledStrings.resetfaces!() |
| 42 | + |
| 43 | + StyledStrings.withfaces(:yellow => StyledStrings.Face(foreground=:red), :green => :blue) do |
| 44 | + println(colorio, styled"{yellow:red} and {green:blue} mixed make {magenta:purple}") |
| 45 | + end |
| 46 | + |
| 47 | + __init__() |
| 48 | + end |
| 49 | + StyledStrings.FACES.current[] = copy(StyledStrings.FACES.default) |
41 | 50 | end
|
0 commit comments