@@ -94,6 +94,8 @@ func main() {
9494
9595 // use style tag
9696 color.Print (" <suc>he</><comment>llo</>, <cyan>wel</><red>come</>\n " )
97+ // Custom label attr: Supports the use of 16 color names, 256 color values, rgb color values and hex color values
98+ color.Println (" <fg=11aa23>he</><bg=120,35,156>llo</>, <fg=167;bg=232>wel</><fg=red>come</>" )
9799
98100 // apply a style tag
99101 color.Tag (" info" ).Println (" info style text" )
@@ -112,14 +114,34 @@ Run demo: `go run ./_examples/demo.go`
112114
113115![ colored-out] ( _examples/images/color-demo.jpg )
114116
115- ## Custom Build Color
117+ ## Basic/16 color
118+
119+ Supported on any Windows version. Provide generic API methods: ` Print ` , ` Printf ` , ` Println ` , ` Sprint ` , ` Sprintf `
116120
117121``` go
122+ color.Bold .Println (" bold message" )
123+ color.Black .Println (" bold message" )
124+ color.White .Println (" bold message" )
125+ color.Gray .Println (" bold message" )
126+ color.Red .Println (" yellow message" )
127+ color.Blue .Println (" yellow message" )
128+ color.Cyan .Println (" yellow message" )
129+ color.Yellow .Println (" yellow message" )
130+ color.Magenta .Println (" yellow message" )
131+
118132// Only use foreground color
119133color.FgCyan .Printf (" Simple to use %s \n " , " color" )
120134// Only use background color
121135color.BgRed .Printf (" Simple to use %s \n " , " color" )
136+ ```
122137
138+ Run demo: ` go run ./_examples/color_16.go `
139+
140+ ![ basic-color] ( _examples/images/basic-color.png )
141+
142+ ### Custom build color
143+
144+ ``` go
123145// Full custom: foreground, background, option
124146myStyle := color.New (color.FgWhite , color.BgBlack , color.OpBold )
125147myStyle.Println (" custom color style" )
@@ -141,49 +163,9 @@ fmt.Print("message")
141163color.Reset ()
142164```
143165
144- ## Basic Color
166+ ### Additional styles
145167
146- Supported on any Windows version.
147-
148- - ` color.Bold `
149- - ` color.Black `
150- - ` color.White `
151- - ` color.Gray `
152- - ` color.Red `
153- - ` color.Green `
154- - ` color.Yellow `
155- - ` color.Blue `
156- - ` color.Magenta `
157- - ` color.Cyan `
158-
159- ``` go
160- color.Bold .Println (" bold message" )
161- color.Yellow .Println (" yellow message" )
162- ```
163-
164- Run demo: ` go run ./_examples/color_16.go `
165-
166- ![ basic-color] ( _examples/images/basic-color.png )
167-
168- ## Additional styles
169-
170- Supported on any Windows version.
171-
172- - ` color.Info `
173- - ` color.Note `
174- - ` color.Warn `
175- - ` color.Light `
176- - ` color.Error `
177- - ` color.Danger `
178- - ` color.Debug `
179- - ` color.Notice `
180- - ` color.Success `
181- - ` color.Comment `
182- - ` color.Primary `
183- - ` color.Question `
184- - ` color.Secondary `
185-
186- ### Basic Style
168+ provide generic API methods: ` Print ` , ` Printf ` , ` Println ` , ` Sprint ` , ` Sprintf `
187169
188170print message use defined style:
189171
@@ -204,7 +186,7 @@ Run demo: `go run ./_examples/theme_basic.go`
204186
205187![ theme-basic] ( _examples/images/theme-basic.png )
206188
207- ### Tips Style
189+ ** Tips style **
208190
209191``` go
210192color.Info .Tips (" Info tips message" )
@@ -223,7 +205,7 @@ Run demo: `go run ./_examples/theme_tips.go`
223205
224206![ theme-tips] ( _examples/images/theme-tips.png )
225207
226- ### Prompt Style
208+ ** Prompt Style**
227209
228210``` go
229211color.Info .Prompt (" Info prompt message" )
@@ -242,7 +224,7 @@ Run demo: `go run ./_examples/theme_prompt.go`
242224
243225![ theme-prompt] ( _examples/images/theme-prompt.png )
244226
245- ### Block Style
227+ ** Block Style**
246228
247229``` go
248230color.Info .Block (" Info block message" )
@@ -261,34 +243,6 @@ Run demo: `go run ./_examples/theme_block.go`
261243
262244![ theme-block] ( _examples/images/theme-block.png )
263245
264- ## HTML-like tag usage
265-
266- ** Supported** on Windows ` cmd.exe ` ` PowerShell ` .
267-
268- ``` go
269- // use style tag
270- color.Print (" <suc>he</><comment>llo</>, <cyan>wel</><red>come</>" )
271- color.Println (" <suc>hello</>" )
272- color.Println (" <error>hello</>" )
273- color.Println (" <warning>hello</>" )
274-
275- // custom color attributes
276- color.Print (" <fg=yellow;bg=black;op=underscore;>hello, welcome</>\n " )
277- ```
278-
279- - ` color.Tag `
280-
281- ``` go
282- // set a style tag
283- color.Tag (" info" ).Print (" info style text" )
284- color.Tag (" info" ).Printf (" %s style text" , " info" )
285- color.Tag (" info" ).Println (" info style text" )
286- ```
287-
288- Run demo: ` go run ./_examples/color_tag.go `
289-
290- ![ color-tags] ( _examples/images/color-tags.png )
291-
292246## 256-color usage
293247
294248> 256 colors support Windows CMD, PowerShell environment after ` v1.2.4 `
@@ -307,7 +261,7 @@ c.Println("message")
307261c.Printf (" format %s " , " message" )
308262```
309263
310- ### Use a 256-color style
264+ ### 256-color style
311265
312266Can be used to set foreground and background colors at the same time.
313267
@@ -333,7 +287,7 @@ Run demo: `go run ./_examples/color_256.go`
333287
334288![ color-tags] ( _examples/images/color-256.png )
335289
336- ## Use RGB color
290+ ## RGB/True color
337291
338292> RGB colors support Windows ` CMD ` , ` PowerShell ` environment after ` v1.2.4 `
339293
@@ -383,7 +337,7 @@ c.Println("message")
383337c.Printf (" format %s " , " message" )
384338```
385339
386- ### Use an RGB color style
340+ ### RGB color style
387341
388342Can be used to set the foreground and background colors at the same time.
389343
@@ -415,6 +369,37 @@ s.Println("style with options")
415369s.Printf (" style with %s \n " , " options" )
416370```
417371
372+ ## HTML-like tag usage
373+
374+ ** Supported** on Windows ` cmd.exe ` ` PowerShell ` .
375+
376+ ``` go
377+ // use style tag
378+ color.Print (" <suc>he</><comment>llo</>, <cyan>wel</><red>come</>" )
379+ color.Println (" <suc>hello</>" )
380+ color.Println (" <error>hello</>" )
381+ color.Println (" <warning>hello</>" )
382+
383+ // custom color attributes
384+ color.Print (" <fg=yellow;bg=black;op=underscore;>hello, welcome</>\n " )
385+
386+ // Custom label attr: Supports the use of 16 color names, 256 color values, rgb color values and hex color values
387+ color.Println (" <fg=11aa23>he</><bg=120,35,156>llo</>, <fg=167;bg=232>wel</><fg=red>come</>" )
388+ ```
389+
390+ - ` color.Tag `
391+
392+ ``` go
393+ // set a style tag
394+ color.Tag (" info" ).Print (" info style text" )
395+ color.Tag (" info" ).Printf (" %s style text" , " info" )
396+ color.Tag (" info" ).Println (" info style text" )
397+ ```
398+
399+ Run demo: ` go run ./_examples/color_tag.go `
400+
401+ ![ color-tags] ( _examples/images/color-tags.png )
402+
418403## Color convert
419404
420405Supports conversion between Rgb, 256, 16 colors, ` Rgb <=> 256 <=> 16 `
0 commit comments