mirror of
https://github.com/docker/compose.git
synced 2025-07-28 08:04:09 +02:00
Eliminate magic number in init functions
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
This commit is contained in:
parent
fb5a8644c3
commit
b4c44a431f
@ -59,6 +59,9 @@ const (
|
|||||||
Auto = "auto"
|
Auto = "auto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ansiColorOffset is the offset for basic foreground colors in ANSI escape codes.
|
||||||
|
const ansiColorOffset = 30
|
||||||
|
|
||||||
// SetANSIMode configure formatter for colored output on ANSI-compliant console
|
// SetANSIMode configure formatter for colored output on ANSI-compliant console
|
||||||
func SetANSIMode(streams command.Streams, ansi string) {
|
func SetANSIMode(streams command.Streams, ansi string) {
|
||||||
if !useAnsi(streams, ansi) {
|
if !useAnsi(streams, ansi) {
|
||||||
@ -127,8 +130,8 @@ func rainbowColor() colorFunc {
|
|||||||
func init() {
|
func init() {
|
||||||
colors := map[string]colorFunc{}
|
colors := map[string]colorFunc{}
|
||||||
for i, name := range names {
|
for i, name := range names {
|
||||||
colors[name] = makeColorFunc(strconv.Itoa(30 + i))
|
colors[name] = makeColorFunc(strconv.Itoa(ansiColorOffset + i))
|
||||||
colors["intense_"+name] = makeColorFunc(strconv.Itoa(30+i) + ";1")
|
colors["intense_"+name] = makeColorFunc(strconv.Itoa(ansiColorOffset+i) + ";1")
|
||||||
}
|
}
|
||||||
rainbow = []colorFunc{
|
rainbow = []colorFunc{
|
||||||
colors["cyan"],
|
colors["cyan"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user