neowofetch/asciiarts/asciiart.go

31 lines
921 B
Go
Raw Normal View History

2022-09-25 20:50:20 +02:00
package asciiarts
import (
"embed"
2022-09-25 20:50:20 +02:00
"strings"
)
//go:embed *.txt
var asciifiles embed.FS
2022-09-25 20:50:20 +02:00
func GetAscii(distroID string) string {
asciiBuff, error := asciifiles.ReadFile(distroID + ".txt")
if error != nil {
asciiBuff, _ = asciifiles.ReadFile("unknown.txt")
}
ascii := string(asciiBuff)
2022-09-25 20:50:20 +02:00
ascii = strings.ReplaceAll(ascii, "{WHITE}", "")
ascii = strings.ReplaceAll(ascii, "{YELLOW}", "")
ascii = strings.ReplaceAll(ascii, "{BLUE}", "")
2022-09-26 09:13:21 +02:00
ascii = strings.ReplaceAll(ascii, "{LPINK}", "")
ascii = strings.ReplaceAll(ascii, "{BACKGROUND_GREEN}", "")
ascii = strings.ReplaceAll(ascii, "{NORMAL}", "")
ascii = strings.ReplaceAll(ascii, "{BLACK}", "")
ascii = strings.ReplaceAll(ascii, "{GREEN}", "")
ascii = strings.ReplaceAll(ascii, "{RED}", "")
ascii = strings.ReplaceAll(ascii, "{PINK}", "")
ascii = strings.ReplaceAll(ascii, "{MAGENTA}", "")
ascii = strings.ReplaceAll(ascii, "{CYAN}", "")
2022-09-25 20:50:20 +02:00
return ascii
}