color_test.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package color
  2. import (
  3. "fmt"
  4. "testing"
  5. "github.com/labstack/gommon/color"
  6. )
  7. func TestText(t *testing.T) {
  8. fmt.Println("*** colored text ***")
  9. fmt.Println(color.Black("black"))
  10. fmt.Println(color.Red("red"))
  11. fmt.Println(color.Green("green"))
  12. fmt.Println(color.Yellow("yellow"))
  13. fmt.Println(color.Blue("blue"))
  14. fmt.Println(color.Magenta("magenta"))
  15. fmt.Println(color.Cyan("cyan"))
  16. fmt.Println(color.White("white"))
  17. fmt.Println(color.Grey("grey"))
  18. }
  19. func TestBackground(t *testing.T) {
  20. fmt.Println("*** colored background ***")
  21. fmt.Println(color.BlackBg("black background", color.Wht))
  22. fmt.Println(color.RedBg("red background"))
  23. fmt.Println(color.GreenBg("green background"))
  24. fmt.Println(color.YellowBg("yellow background"))
  25. fmt.Println(color.BlueBg("blue background"))
  26. fmt.Println(color.MagentaBg("magenta background"))
  27. fmt.Println(color.CyanBg("cyan background"))
  28. fmt.Println(color.WhiteBg("white background"))
  29. }
  30. func TestEmphasis(t *testing.T) {
  31. fmt.Println("*** emphasis ***")
  32. fmt.Println(color.Bold("bold"))
  33. fmt.Println(color.Dim("dim"))
  34. fmt.Println(color.Italic("italic"))
  35. fmt.Println(color.Underline("underline"))
  36. fmt.Println(color.Inverse("inverse"))
  37. fmt.Println(color.Hidden("hidden"))
  38. fmt.Println(color.Strikeout("strikeout"))
  39. }
  40. func TestMixMatch(t *testing.T) {
  41. fmt.Println("*** mix and match ***")
  42. fmt.Println(Green("bold green with white background", B, WhtBg))
  43. fmt.Println(Red("underline red", U))
  44. fmt.Println(Yellow("dim yellow", D))
  45. fmt.Println(Cyan("inverse cyan", In))
  46. fmt.Println(Blue("bold underline dim blue", B, U, D))
  47. }