mirror of
https://github.com/fatih/color.git
synced 2024-11-24 08:02:14 +02:00
Apply suggestions from code review
Co-authored-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
This commit is contained in:
parent
5723903daa
commit
1ff0f97908
@ -32,7 +32,7 @@ color.Magenta("And many others ..")
|
|||||||
|
|
||||||
### RGB colors
|
### RGB colors
|
||||||
|
|
||||||
If your terminal supports 24-bit colors, you can use RGB color codes
|
If your terminal supports 24-bit colors, you can use RGB color codes.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
color.RGB(255, 128, 0).Println("foreground orange")
|
color.RGB(255, 128, 0).Println("foreground orange")
|
||||||
|
8
color.go
8
color.go
@ -99,7 +99,7 @@ const (
|
|||||||
FgCyan
|
FgCyan
|
||||||
FgWhite
|
FgWhite
|
||||||
|
|
||||||
// used internally for 256 and 24bit coloring
|
// used internally for 256 and 24-bit coloring
|
||||||
foreground
|
foreground
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ const (
|
|||||||
BgCyan
|
BgCyan
|
||||||
BgWhite
|
BgWhite
|
||||||
|
|
||||||
// used internally for 256 and 24bit coloring
|
// used internally for 256 and 24-bit coloring
|
||||||
background
|
background
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -156,12 +156,12 @@ func New(value ...Attribute) *Color {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
// RGB returns a newly created foreground 24-bit RGB color.
|
// RGB returns a new foreground color in 24-bit RGB.
|
||||||
func RGB(r, g, b int) *Color {
|
func RGB(r, g, b int) *Color {
|
||||||
return New(foreground, 2, Attribute(r), Attribute(g), Attribute(b))
|
return New(foreground, 2, Attribute(r), Attribute(g), Attribute(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
// BgRGB returns a newly created 24-bit background RGB color.
|
// BgRGB returns a new background color in 24-bit RGB.
|
||||||
func BgRGB(r, g, b int) *Color {
|
func BgRGB(r, g, b int) *Color {
|
||||||
return New(background, 2, Attribute(r), Attribute(g), Attribute(b))
|
return New(background, 2, Attribute(r), Attribute(g), Attribute(b))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user