Simplify color map system

This commit is contained in:
2025-08-23 17:43:51 +03:00
parent 74eb84e706
commit 1439a22378
3 changed files with 37 additions and 44 deletions
+23
View File
@@ -0,0 +1,23 @@
package main
import (
"fmt"
"strconv"
"strings"
)
func setupColorMap(asciiArt string) map[string]string {
colorMap := make(map[string]string)
// Read colors from ascii art
if strings.HasPrefix(asciiArt, "#/") {
firstLine := strings.Split(asciiArt, "\n")[0]
ansiColors := strings.Split(strings.TrimPrefix(firstLine, "#/"), ";")
for i, ansiColor := range ansiColors {
colorMap["C"+strconv.Itoa(i+1)] = fmt.Sprintf("\033[38;5;%sm", ansiColor)
}
}
return colorMap
}