mirror of
https://github.com/EnumeratedDev/stormfetch.git
synced 2026-09-15 23:46:12 +00:00
Simplify color map system
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user