Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to only save with color using go library #32

Open
AuroraLi opened this issue Jan 26, 2023 · 1 comment
Open

Unable to only save with color using go library #32

AuroraLi opened this issue Jan 26, 2023 · 1 comment

Comments

@AuroraLi
Copy link

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?

@TheZoraiz
Copy link
Owner

Looks like solution to this would be applicable for issue #31 as well. I'll release an update for this as soon as I get time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants