github.com/blend/go-sdk@v1.20220411.3/logger/colorize.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package logger
     9  
    10  import (
    11  	"github.com/blend/go-sdk/ansi"
    12  )
    13  
    14  var (
    15  	// DefaultFlagTextColors is the default color for each known flag.
    16  	DefaultFlagTextColors = map[string]ansi.Color{
    17  		Info:    ansi.ColorLightWhite,
    18  		Debug:   ansi.ColorLightYellow,
    19  		Warning: ansi.ColorLightYellow,
    20  		Error:   ansi.ColorRed,
    21  		Fatal:   ansi.ColorRed,
    22  	}
    23  
    24  	// DefaultFlagTextColor is the default flag color.
    25  	DefaultFlagTextColor = ansi.ColorLightWhite
    26  )
    27  
    28  // FlagTextColor returns the color for a flag.
    29  func FlagTextColor(flag string) ansi.Color {
    30  	if color, hasColor := DefaultFlagTextColors[flag]; hasColor {
    31  		return color
    32  	}
    33  	return DefaultFlagTextColor
    34  }