defaultColors is a function to override default colors to config
(colors *Colors)
| 67 | |
| 68 | // defaultColors is a function to override default colors to config |
| 69 | func defaultColors(colors *Colors) Colors { |
| 70 | if colors == nil { |
| 71 | return DefaultColors |
| 72 | } |
| 73 | |
| 74 | cfg := *colors |
| 75 | |
| 76 | if cfg.Black == "" { |
| 77 | cfg.Black = DefaultColors.Black |
| 78 | } |
| 79 | |
| 80 | if cfg.Red == "" { |
| 81 | cfg.Red = DefaultColors.Red |
| 82 | } |
| 83 | |
| 84 | if cfg.Green == "" { |
| 85 | cfg.Green = DefaultColors.Green |
| 86 | } |
| 87 | |
| 88 | if cfg.Yellow == "" { |
| 89 | cfg.Yellow = DefaultColors.Yellow |
| 90 | } |
| 91 | |
| 92 | if cfg.Blue == "" { |
| 93 | cfg.Blue = DefaultColors.Blue |
| 94 | } |
| 95 | |
| 96 | if cfg.Magenta == "" { |
| 97 | cfg.Magenta = DefaultColors.Magenta |
| 98 | } |
| 99 | |
| 100 | if cfg.Cyan == "" { |
| 101 | cfg.Cyan = DefaultColors.Cyan |
| 102 | } |
| 103 | |
| 104 | if cfg.White == "" { |
| 105 | cfg.White = DefaultColors.White |
| 106 | } |
| 107 | |
| 108 | if cfg.Reset == "" { |
| 109 | cfg.Reset = DefaultColors.Reset |
| 110 | } |
| 111 | |
| 112 | return cfg |
| 113 | } |