diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2022-02-04 21:37:29 +0000 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2022-02-04 21:37:29 +0000 |
| commit | 1db3b5dc1219e34e0e1c612e6646327701c40274 (patch) | |
| tree | cab22128af9e54131facd0062a474459383a1c90 /internal/color/table.go | |
| parent | 6625d019271d3d7931587167845d77834d187d57 (diff) | |
| parent | cc6f19f69d0fb34af96e17147b2030c352d46845 (diff) | |
merge 4.0.0-RC
Diffstat (limited to 'internal/color/table.go')
| -rw-r--r-- | internal/color/table.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/internal/color/table.go b/internal/color/table.go new file mode 100644 index 0000000..e0e4946 --- /dev/null +++ b/internal/color/table.go @@ -0,0 +1,53 @@ +package color + +import ( + "fmt" + "os" +) + +const sampleParagraph string = "Mimecast is Making Email Safer for Business. " + + "We believe that securely operating a business in the cloud requires new " + + "levels of IT preparedness, centered around cyber resilience. This is why " + + "we unify the delivery and management of security, continuity and data " + + "protection for email via one, simple-to-use cloud platform. Thousands of " + + "organizations trust us to increase their cyber resilience preparedness, " + + "streamline compliance, reduce IT complexity and keep their business running. " + + "We give employees fast and secure access to sensitive business information, " + + "and ensure email keeps flowing in the event of an outage. Mimecast will " + + "remain committed to protecting your IT assets through constant innovation " + + "and focus on your success." + +// TablePrintAndExit prints the color table and then exits the process. +func TablePrintAndExit(displaySampleParagraph bool) { + for _, attr := range AttributeNames { + if attr == "Hidden" || attr == "SlowBlink" { + continue + } + printColorTable(attr, displaySampleParagraph) + } + os.Exit(0) +} + +func printColorTable(attr string, displaySampleParagraph bool) { + for _, fg := range ColorNames { + fgColor, _ := ToFgColor(fg) + for _, bg := range ColorNames { + if fg == bg { + continue + } + + bgColor, _ := ToBgColor(bg) + attribute, _ := ToAttribute(attr) + text := fmt.Sprintf(" Foreground:%10s | Background:%10s | Attribute:%10s ", + fg, bg, attr) + fmt.Print(PaintStrWithAttr(text, fgColor, bgColor, attribute)) + + if displaySampleParagraph { + fmt.Print("\n") + fmt.Print(PaintStrWithAttr(sampleParagraph, fgColor, bgColor, attribute)) + fmt.Print("\n") + } + fmt.Print("\n") + } + } +} |
