| 86 | } |
| 87 | |
| 88 | func (h *Handler) parseColors(colorsStr string) error { |
| 89 | if len(colorsStr) > 0 { |
| 90 | colors := strings.Split(colorsStr, ",") |
| 91 | |
| 92 | h.Colors = make([]int, len(colors)) |
| 93 | |
| 94 | for i, s := range colors { |
| 95 | color, err := strconv.Atoi(strings.TrimSpace(s)) |
| 96 | if err != nil || color < 0 || color > 255 { |
| 97 | return fmt.Errorf("Invalid xterm color code: %s", s) |
| 98 | } |
| 99 | h.Colors[i] = color |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | return nil |
| 104 | } |
| 105 | |
| 106 | func (h *Handler) parseFormation(formation string) error { |
| 107 | if len(formation) > 0 { |