-
Notifications
You must be signed in to change notification settings - Fork 0
/
Strings.cs
100 lines (81 loc) · 4.33 KB
/
Strings.cs
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
namespace Meep.Tech.Text {
/// <summary>
/// Extension methods for ANSI strings.
/// </summary>
public static class ANSIStringExtensions {
/// <inheritdoc cref="ANSI.AddColor(string, ANSI.Color, bool)"/>
public static string Color(this string text, ANSI.Color color)
=> ANSI.AddColor(text, color);
/// <inheritdoc cref="ANSI.AddColor(string, ANSI.RGB, bool)"/>
public static string Color(this string text, ANSI.RGB color)
=> ANSI.AddColor(text, color);
/// <inheritdoc cref="ANSI.AddBg(string, ANSI.Bg, bool)"/>
public static string Bg(this string text, ANSI.Bg bg)
=> ANSI.AddBg(text, bg);
/// <inheritdoc cref="ANSI.AddBg(string, ANSI.Color, bool)"/>
public static string Bg(this string text, ANSI.Color bg)
=> ANSI.AddBg(text, bg);
/// <inheritdoc cref="ANSI.AddBg(string, ANSI.RGB, bool)"/>
public static string Bg(this string text, ANSI.RGB bg)
=> ANSI.AddBg(text, bg);
/// <inheritdoc cref="ANSI.AddEffect(string, ANSI.Effect, bool)"/>
public static string Effect(this string text, ANSI.Effect effect)
=> ANSI.AddEffect(text, effect);
/// <inheritdoc cref="ANSI.Bold(string, bool)"/>
public static string Bold(this string text)
=> ANSI.Bold(text);
/// <inheritdoc cref="ANSI.Italic(string, bool)"/>
public static string Italic(this string text)
=> ANSI.Italic(text);
/// <inheritdoc cref="ANSI.Underline(string, bool)"/>
public static string Underline(this string text)
=> ANSI.Underline(text);
/// <inheritdoc cref="ANSI.Indent(string, int, string, bool, bool)"/>
/// <param name="text"><inheritdoc cref="ANSI.Indent(string, int, string, bool, bool)" path="/param[@name='text']"/></param>
/// <param name="count"><inheritdoc cref="ANSI.Indent(string, int, string, bool, bool)" path="/param[@name='count']"/></param>
/// <param name="indent"><inheritdoc cref="ANSI.Indent(string, int, string, bool, bool)" path="/param[@name='indent']"/></param>
/// <param name="inline">Determines if the indent should be inline or not (if false, a newline and indent are prepended). (Defaults to false)</param>
public static string Indent(this string text, int count = 1, string indent = "\t", bool inline = false)
=> ANSI.Indent(text, count, indent, !inline, !inline);
/// <inheritdoc cref="ANSI.Dedent(string, int, string)"/>
public static string Dedent(this string text, int count = 1, string indent = "\t| ")
=> ANSI.Dedent(text, count, indent);
/// <inheritdoc cref="ANSI.Undent(string)"/>
public static string Undent(this string text)
=> ANSI.Undent(text);
/// <inheritdoc cref="ANSI.Stylize(string, ANSI.Color?, ANSI.Bg?, ANSI.Effect?, bool)"/>
public static string Style(
this string text,
ANSI.Color? color = null!,
ANSI.Bg? bg = null!,
ANSI.Effect? effect = null!
) => ANSI.Stylize(text, color, bg, effect);
/// <inheritdoc cref="ANSI.Stylize(string, ANSI.Color?, ANSI.Bg?, ANSI.Effect?, bool)"/>
public static string Style(
this string text,
ANSI.RGB color,
ANSI.Bg? bg = null!,
ANSI.Effect? effect = null!
) => ANSI.Stylize(text, color, bg, effect);
/// <inheritdoc cref="ANSI.Stylize(string, ANSI.Color?, ANSI.Bg?, ANSI.Effect?, bool)"/>
public static string Style(
this string text,
ANSI.Color? color = null!,
ANSI.RGB? bg = null!,
ANSI.Effect? effect = null!
) => ANSI.Stylize(text, color, bg, effect);
/// <inheritdoc cref="ANSI.Stylize(string, ANSI.Color?, ANSI.Bg?, ANSI.Effect?, bool)"/>
public static string Style(
this string text,
ANSI.RGB? color,
ANSI.RGB? bg,
ANSI.Effect? effect = null!
) => ANSI.Stylize(text, color, bg, effect);
/// <inheritdoc cref="ANSI.Clear(string)"/>
public static string Strip(this string text)
=> ANSI.Clear(text);
/// <inheritdoc cref="ANSI.Reset(string)"/>
public static string Reset(this string text)
=> ANSI.Reset(text);
}
}