microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Common/Text/StringBuilder.cs
131lines · modecode
| 1 | using System.Text; |
| 2 | |
| 3 | namespace Microsoft.Teams.Common.Text; |
| 4 | |
| 5 | public static class StringBuilderExtensions |
| 6 | { |
| 7 | public static StringBuilder Reset(this StringBuilder builder) |
| 8 | { |
| 9 | return builder.Append(ANSI.Reset); |
| 10 | } |
| 11 | |
| 12 | public static StringBuilder Append(this StringBuilder builder, ANSI code, string text) |
| 13 | { |
| 14 | return builder.Append(code).Append(text).Append(ANSI.Reset); |
| 15 | } |
| 16 | |
| 17 | public static StringBuilder Bold(this StringBuilder builder, string text) |
| 18 | { |
| 19 | return builder.Append(ANSI.Bold).Append(text).Append(ANSI.BoldReset); |
| 20 | } |
| 21 | |
| 22 | public static StringBuilder Italic(this StringBuilder builder, string text) |
| 23 | { |
| 24 | return builder.Append(ANSI.Italic).Append(text).Append(ANSI.ItalicReset); |
| 25 | } |
| 26 | |
| 27 | public static StringBuilder Underline(this StringBuilder builder, string text) |
| 28 | { |
| 29 | return builder.Append(ANSI.Underline).Append(text).Append(ANSI.UnderlineReset); |
| 30 | } |
| 31 | |
| 32 | public static StringBuilder Strike(this StringBuilder builder, string text) |
| 33 | { |
| 34 | return builder.Append(ANSI.Strike).Append(text).Append(ANSI.StrikeReset); |
| 35 | } |
| 36 | |
| 37 | public static StringBuilder Black(this StringBuilder builder, string text) |
| 38 | { |
| 39 | return builder.Append(ANSI.ForegroundBlack).Append(text).Append(ANSI.ForegroundReset); |
| 40 | } |
| 41 | |
| 42 | public static StringBuilder BgBlack(this StringBuilder builder, string text) |
| 43 | { |
| 44 | return builder.Append(ANSI.BackgroundBlack).Append(text).Append(ANSI.BackgroundReset); |
| 45 | } |
| 46 | |
| 47 | public static StringBuilder Red(this StringBuilder builder, string text) |
| 48 | { |
| 49 | return builder.Append(ANSI.ForegroundRed).Append(text).Append(ANSI.ForegroundReset); |
| 50 | } |
| 51 | |
| 52 | public static StringBuilder BgRed(this StringBuilder builder, string text) |
| 53 | { |
| 54 | return builder.Append(ANSI.BackgroundRed).Append(text).Append(ANSI.BackgroundReset); |
| 55 | } |
| 56 | |
| 57 | public static StringBuilder Green(this StringBuilder builder, string text) |
| 58 | { |
| 59 | return builder.Append(ANSI.ForegroundGreen).Append(text).Append(ANSI.ForegroundReset); |
| 60 | } |
| 61 | |
| 62 | public static StringBuilder BgGreen(this StringBuilder builder, string text) |
| 63 | { |
| 64 | return builder.Append(ANSI.BackgroundGreen).Append(text).Append(ANSI.BackgroundReset); |
| 65 | } |
| 66 | |
| 67 | public static StringBuilder Yellow(this StringBuilder builder, string text) |
| 68 | { |
| 69 | return builder.Append(ANSI.ForegroundYellow).Append(text).Append(ANSI.ForegroundReset); |
| 70 | } |
| 71 | |
| 72 | public static StringBuilder BgYellow(this StringBuilder builder, string text) |
| 73 | { |
| 74 | return builder.Append(ANSI.BackgroundYellow).Append(text).Append(ANSI.BackgroundReset); |
| 75 | } |
| 76 | |
| 77 | public static StringBuilder Blue(this StringBuilder builder, string text) |
| 78 | { |
| 79 | return builder.Append(ANSI.ForegroundBlue).Append(text).Append(ANSI.ForegroundReset); |
| 80 | } |
| 81 | |
| 82 | public static StringBuilder BgBlue(this StringBuilder builder, string text) |
| 83 | { |
| 84 | return builder.Append(ANSI.BackgroundBlue).Append(text).Append(ANSI.BackgroundReset); |
| 85 | } |
| 86 | |
| 87 | public static StringBuilder Magenta(this StringBuilder builder, string text) |
| 88 | { |
| 89 | return builder.Append(ANSI.ForegroundMagenta).Append(text).Append(ANSI.ForegroundReset); |
| 90 | } |
| 91 | |
| 92 | public static StringBuilder BgMagenta(this StringBuilder builder, string text) |
| 93 | { |
| 94 | return builder.Append(ANSI.BackgroundMagenta).Append(text).Append(ANSI.BackgroundReset); |
| 95 | } |
| 96 | |
| 97 | public static StringBuilder Cyan(this StringBuilder builder, string text) |
| 98 | { |
| 99 | return builder.Append(ANSI.ForegroundCyan).Append(text).Append(ANSI.ForegroundReset); |
| 100 | } |
| 101 | |
| 102 | public static StringBuilder BgCyan(this StringBuilder builder, string text) |
| 103 | { |
| 104 | return builder.Append(ANSI.BackgroundCyan).Append(text).Append(ANSI.BackgroundReset); |
| 105 | } |
| 106 | |
| 107 | public static StringBuilder White(this StringBuilder builder, string text) |
| 108 | { |
| 109 | return builder.Append(ANSI.ForegroundWhite).Append(text).Append(ANSI.ForegroundReset); |
| 110 | } |
| 111 | |
| 112 | public static StringBuilder BgWhite(this StringBuilder builder, string text) |
| 113 | { |
| 114 | return builder.Append(ANSI.BackgroundWhite).Append(text).Append(ANSI.BackgroundReset); |
| 115 | } |
| 116 | |
| 117 | public static StringBuilder Gray(this StringBuilder builder, string text) |
| 118 | { |
| 119 | return builder.Append(ANSI.ForegroundGray).Append(text).Append(ANSI.ForegroundReset); |
| 120 | } |
| 121 | |
| 122 | public static StringBuilder Default(this StringBuilder builder, string text) |
| 123 | { |
| 124 | return builder.Append(ANSI.ForegroundDefault).Append(text).Append(ANSI.ForegroundReset); |
| 125 | } |
| 126 | |
| 127 | public static StringBuilder BgDefault(this StringBuilder builder, string text) |
| 128 | { |
| 129 | return builder.Append(ANSI.BackgroundDefault).Append(text).Append(ANSI.BackgroundReset); |
| 130 | } |
| 131 | } |