| 93 | } |
| 94 | |
| 95 | func TestColorToColor(t *testing.T) { |
| 96 | uu := map[string]struct { |
| 97 | c string |
| 98 | e tcell.Color |
| 99 | }{ |
| 100 | "default": { |
| 101 | c: "default", |
| 102 | e: tcell.ColorDefault, |
| 103 | }, |
| 104 | "transparent": { |
| 105 | c: "-", |
| 106 | e: tcell.ColorDefault, |
| 107 | }, |
| 108 | "aqua": { |
| 109 | c: "aqua", |
| 110 | e: tcell.ColorAqua.TrueColor(), |
| 111 | }, |
| 112 | } |
| 113 | |
| 114 | for k := range uu { |
| 115 | u := uu[k] |
| 116 | t.Run(k, func(t *testing.T) { |
| 117 | c := config.NewColor(u.c) |
| 118 | assert.Equal(t, u.e, c.Color()) |
| 119 | }) |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | // getOkch returns c, h for a hex color string. |
| 124 | func getOkch(hex string) (c, h float64) { |