github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/pkg/meta/styles.go (about) 1 /* 2 * Copyright (c) 2018-2020 vChain, Inc. All Rights Reserved. 3 * This software is released under GPL3. 4 * The full license information can be found under: 5 * https://www.gnu.org/licenses/gpl-3.0.en.html 6 * 7 */ 8 9 package meta 10 11 import ( 12 "github.com/fatih/color" 13 ) 14 15 // StatusColor returns color.Attribute(s) for the given status 16 func StatusColor(status Status) (color.Attribute, color.Attribute, color.Attribute) { 17 switch status { 18 case StatusTrusted: 19 return StyleSuccess() 20 case StatusUnknown: 21 return StyleWarning() 22 case StatusApikeyRevoked: 23 return StyleWarning() 24 default: 25 return StyleError() 26 } 27 } 28 29 // StyleAffordance returns color.Attribute(s) for affordance messages 30 func StyleAffordance() (color.Attribute, color.Attribute, color.Attribute) { 31 return color.FgGreen, color.Bold, color.BgBlack 32 } 33 34 // StyleError returns color.Attribute(s) for error messages 35 func StyleError() (color.Attribute, color.Attribute, color.Attribute) { 36 return color.FgRed, color.Bold, color.BgBlack 37 } 38 39 // StyleWarning returns color.Attribute(s) for warning messages 40 func StyleWarning() (color.Attribute, color.Attribute, color.Attribute) { 41 return color.FgYellow, color.Bold, color.BgBlack 42 } 43 44 // StyleSuccess returns color.Attribute(s) for success messages 45 func StyleSuccess() (color.Attribute, color.Attribute, color.Attribute) { 46 return color.FgGreen, color.Bold, color.BgBlack 47 }