Debian Codegraph @

pkg/color/attrs.go

raw symbols SCIP
1 package colorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/
2
3 // Attribute represents a single SGR (Select Graphic Rendition) code used for
4 // styling terminal text output. It is an integer type that corresponds to
5 // specific ANSI escape sequence parameter values for controlling text
6 // appearance, including colors, formatting, and visual effects.
7 //
8 // Attribute values are designed to be combined when constructing ANSI escape
9 // sequences. The zero value (Reset) clears all formatting and returns text
10 // to the default terminal appearance.
11 //
12 // Attributes are used in conjunction with the Color type to create reusable
13 // styling configurations that can be applied to strings for colored terminal
14 // output.
15 type Attributescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Attribute# int
16
17 // Internal constants used for constructing ANSI escape sequences and
18 // managing buffer allocations.
19 const (
20 // escape is the ANSI escape character (ESC, 0x1b) used to begin
21 // escape sequences for terminal control and styling.
22 escapescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/escape. = "\x1b"
23
24 // builderGrowthFactor specifies the multiplier used for pre-allocating
25 // strings.Builder capacity when constructing escape sequences. This
26 // value provides a reasonable buffer for typical SGR sequences
27 // containing multiple attributes.
28 builderGrowthFactorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/builderGrowthFactor. = 4
29
30 // rgbColorFormatSpecifier is the SGR parameter value (2) that indicates
31 // the following parameters specify a 24-bit RGB color using the format
32 // "38;2;R;G;B" for foreground or "48;2;R;G;B" for background colors.
33 rgbColorFormatSpecifierscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/rgbColorFormatSpecifier. Attributescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Attribute# = 2
34 )
35
36 // Base text formatting attributes.
37 // These attributes control fundamental text styling such as boldness,
38 // italics, underlining, and visibility. Multiple base attributes can be
39 // combined to create complex text formatting.
40 //
41 // Base attributes start at SGR code 0 (Reset) and increment through 9.
42 const (
43 // Reset clears all text formatting and returns to the default terminal
44 // appearance. This is typically used at the end of styled text to
45 // prevent formatting from bleeding into subsequent output.
46 Resetscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Reset. Attributescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Attribute# = iota
47
48 // Bold applies increased intensity to the text, making it appear
49 // thicker and more prominent. Not all terminal emulators support this.
50 Boldscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Bold.
51
52 // Faint applies decreased intensity to the text, making it appear
53 // dimmer or lighter than normal text. Support varies across terminals.
54 Faintscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Faint.
55
56 // Italic applies italic styling to the text. This is not widely
57 // supported across all terminal emulators.
58 Italicscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Italic.
59
60 // Underline adds a line beneath the text. This is commonly supported
61 // across most terminal emulators.
62 Underlinescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Underline.
63
64 // BlinkSlow makes the text blink slowly (less than 150 times per
65 // minute). This is rarely supported in modern terminal emulators.
66 BlinkSlowscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BlinkSlow.
67
68 // BlinkRapid makes the text blink rapidly (150 times per minute or
69 // more). This is rarely supported in modern terminal emulators.
70 BlinkRapidscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BlinkRapid.
71
72 // ReverseVideo swaps the foreground and background colors. This is
73 // useful for highlighting text or creating inverted color schemes.
74 ReverseVideoscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/ReverseVideo.
75
76 // Concealed hides the text, making it invisible. This is sometimes
77 // used for passwords or hidden content. Not widely supported.
78 Concealedscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Concealed.
79
80 // CrossedOut applies a line through the text (strikethrough).
81 // This is useful for indicating deleted or deprecated content.
82 CrossedOutscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/CrossedOut.
83 )
84
85 // Reset attributes for clearing specific text formatting.
86 // These attributes undo the effects of their corresponding base attributes,
87 // allowing selective removal of formatting without a full reset.
88 //
89 // Reset attributes start at SGR code 22 and increment through 29,
90 // corresponding to the base attributes in the 0-9 range.
91 const (
92 // ResetBold removes bold or faint formatting, returning text to
93 // normal intensity.
94 ResetBoldscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/ResetBold. Attributescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Attribute# = iota + 22
95
96 // ResetItalic removes italic formatting from the text.
97 ResetItalicscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/ResetItalic.
98
99 // ResetUnderline removes underline formatting from the text.
100 ResetUnderlinescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/ResetUnderline.
101
102 // ResetBlinking disables any blinking effects applied to the text.
103 ResetBlinkingscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/ResetBlinking.
104
105 // _ is a placeholder for SGR code 25, which is reserved.
106 _
107
108 // ResetReversed restores normal color ordering, undoing the effect
109 // of ReverseVideo.
110 ResetReversedscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/ResetReversed.
111
112 // ResetConcealed makes concealed text visible again.
113 ResetConcealedscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/ResetConcealed.
114
115 // ResetCrossedOut removes the strikethrough formatting from the text.
116 ResetCrossedOutscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/ResetCrossedOut.
117 )
118
119 // Foreground colors for text styling.
120 // These attributes set the text color using the standard 8-color palette
121 // defined in the ANSI standard. Each color corresponds to a specific SGR
122 // code in the 30-37 range.
123 //
124 // Foreground colors can be combined with base attributes and background
125 // colors to create rich text styling.
126 const (
127 // FgBlack sets the foreground color to black.
128 FgBlackscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgBlack. Attributescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Attribute# = iota + 30
129
130 // FgRed sets the foreground color to red.
131 FgRedscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgRed.
132
133 // FgGreen sets the foreground color to green.
134 FgGreenscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgGreen.
135
136 // FgYellow sets the foreground color to yellow.
137 FgYellowscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgYellow.
138
139 // FgBlue sets the foreground color to blue.
140 FgBluescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgBlue.
141
142 // FgMagenta sets the foreground color to magenta (purple).
143 FgMagentascip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgMagenta.
144
145 // FgCyan sets the foreground color to cyan.
146 FgCyanscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgCyan.
147
148 // FgWhite sets the foreground color to white.
149 FgWhitescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgWhite.
150
151 // foreground is an internal marker used to distinguish foreground
152 // color attributes from other attribute types. It is used internally
153 // for implementing 256-color and 24-bit RGB color support.
154 foregroundscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/foreground.
155 )
156
157 // High-intensity foreground colors.
158 // These attributes provide bright or bold variants of the standard
159 // foreground colors, corresponding to SGR codes in the 90-97 range.
160 // High-intensity colors offer better visibility and contrast in
161 // terminal output.
162 const (
163 // FgHiBlack sets the foreground color to bright black (gray).
164 FgHiBlackscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgHiBlack. Attributescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Attribute# = iota + 90
165
166 // FgHiRed sets the foreground color to bright red.
167 FgHiRedscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgHiRed.
168
169 // FgHiGreen sets the foreground color to bright green.
170 FgHiGreenscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgHiGreen.
171
172 // FgHiYellow sets the foreground color to bright yellow.
173 FgHiYellowscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgHiYellow.
174
175 // FgHiBlue sets the foreground color to bright blue.
176 FgHiBluescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgHiBlue.
177
178 // FgHiMagenta sets the foreground color to bright magenta.
179 FgHiMagentascip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgHiMagenta.
180
181 // FgHiCyan sets the foreground color to bright cyan.
182 FgHiCyanscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgHiCyan.
183
184 // FgHiWhite sets the foreground color to bright white.
185 FgHiWhitescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/FgHiWhite.
186 )
187
188 // Background colors for text styling.
189 // These attributes set the background color using the standard 8-color
190 // palette defined in the ANSI standard. Each color corresponds to a
191 // specific SGR code in the 40-47 range.
192 //
193 // Background colors can be combined with foreground colors and text
194 // attributes to create visually distinct output.
195 const (
196 // BgBlack sets the background color to black.
197 BgBlackscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgBlack. Attributescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Attribute# = iota + 40
198
199 // BgRed sets the background color to red.
200 BgRedscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgRed.
201
202 // BgGreen sets the background color to green.
203 BgGreenscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgGreen.
204
205 // BgYellow sets the background color to yellow.
206 BgYellowscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgYellow.
207
208 // BgBlue sets the background color to blue.
209 BgBluescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgBlue.
210
211 // BgMagenta sets the background color to magenta (purple).
212 BgMagentascip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgMagenta.
213
214 // BgCyan sets the background color to cyan.
215 BgCyanscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgCyan.
216
217 // BgWhite sets the background color to white.
218 BgWhitescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgWhite.
219
220 // background is an internal marker used to distinguish background
221 // color attributes from other attribute types. It is used internally
222 // for implementing 256-color and 24-bit RGB color support.
223 backgroundscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/background.
224 )
225
226 // High-intensity background colors.
227 // These attributes provide bright variants of the standard background
228 // colors, corresponding to SGR codes in the 100-107 range.
229 // High-intensity background colors can be used for emphasis or
230 // highlighting specific text regions.
231 const (
232 // BgHiBlack sets the background color to bright black (gray).
233 BgHiBlackscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgHiBlack. Attributescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/Attribute# = iota + 100
234
235 // BgHiRed sets the background color to bright red.
236 BgHiRedscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgHiRed.
237
238 // BgHiGreen sets the background color to bright green.
239 BgHiGreenscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgHiGreen.
240
241 // BgHiYellow sets the background color to bright yellow.
242 BgHiYellowscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgHiYellow.
243
244 // BgHiBlue sets the background color to bright blue.
245 BgHiBluescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgHiBlue.
246
247 // BgHiMagenta sets the background color to bright magenta.
248 BgHiMagentascip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgHiMagenta.
249
250 // BgHiCyan sets the background color to bright cyan.
251 BgHiCyanscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgHiCyan.
252
253 // BgHiWhite sets the background color to bright white.
254 BgHiWhitescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/color`/BgHiWhite.
255 )