dchest / captcha

Go package captcha implements generation and verification of image and audio CAPTCHAs.
godoc.org/github.com/dchest/captcha
MIT License
1.92k stars 294 forks source link

Set background color #21

Closed d-fal closed 5 years ago

d-fal commented 5 years ago

Hi everybody,

I was wondering how one can change background color to something other than transparent.

dchest commented 5 years ago

There's no such setting. But since it's transparent, why not set the background color of a div under the image in CSS?

d-fal commented 5 years ago

Goo idea, Is there any restrictions on the range of foreground colors? I want to make sure about generating discriminating captcha from its background?

dchest commented 5 years ago

The foreground colors are in the range 0-128 https://github.com/dchest/captcha/blob/master/image.go#L74-L79

so the lightest color would be 128, 128, 128.

(To be fair, I don't see any reason for it to be random, as it won't help with security. Not sure why I made it so.)

d-fal commented 5 years ago

I feel better if you limit the range or use single color.

dchest commented 5 years ago

I should do this in the next version, yes. For now, feel free to fork it and change the lines that I linked to above.

d-fal commented 5 years ago

Thank you so much