Unable to only save with color using go library
AuroraLi opened this issue · 1 comments
AuroraLi commented
I am using the go library where a terminal isn't available. It works fine without color, but is throwing error when I set color flag to true
Error:
your terminal supports neither 24-bit nor 8-bit colors. Other coloring options aren't available
Code:
width, err := strconv.Atoi(os.Getenv("WIDTH"))
if err != nil {
panic(err)
}
color := os.Getenv("COLOR")
if len(color) == 0 {
color = "false"
}
color_bool, err := strconv.ParseBool(os.Getenv("COLOR"))
if err != nil {
panic(err)
}
fmt.Println("filename: " + file)
flags := aic_package.DefaultFlags()
flags.SaveImagePath = "."
flags.Colored = color_bool
flags.OnlySave = true
flags.Dimensions = []int{width * 2, width}
fmt.Println("the flags are "+ strconv.FormatBool(flags.OnlySave))
asciiArt, err := aic_package.Convert(file, flags)
if err != nil {
fmt.Println(err)
}
if (len(asciiArt)>0){
fmt.Printf("the converted file is %v\n", asciiArt)
}
How can I save a colored ASCII file?