Shashank3736 / captcha-canvas

A captcha generator by using skia-canvas.
https://captcha-canvas.js.org
Apache License 2.0
61 stars 12 forks source link

feature request: setCaptcha support to pass SetCaptchaOption array #47

Open joyexpr opened 2 years ago

joyexpr commented 2 years ago

feature request: setCaptcha support to pass SetCaptchaOption array, for now, only can pass one SetCaptchaOption

for example, I want generate a captcha: "abcd", and "ab" is red, "cd" is green

Shashank3736 commented 2 years ago

Can you elaborate on the request? Like what you actually want, a feature to customise each character of a captcha.

joyexpr commented 2 years ago

if so, I can let user to enter the specified character, for example:

  1. please enter the red characters
  2. please enter the biggest 2 characters many many possibilities
Shashank3736 commented 2 years ago

Hmm... make sense I will try to add this feature

joyexpr commented 2 years ago

by the way, is it a bug in captcha.ts:

if (option.colors && option.colors?.length > 2) {this._ctx.fillStyle = option.colors[getRandom(option.colors.length - 1)];}

should it be:

if (option.colors && option.colors?.length >= 2)  
Shashank3736 commented 1 year ago

by the way, is it a bug in captcha.ts:

if (option.colors && option.colors?.length > 2) {this._ctx.fillStyle = option.colors[getRandom(option.colors.length - 1)];}

should it be:

if (option.colors && option.colors?.length >= 2)  

Yupp it is a bug. Actually I never use option.colors so I never noticed it. Thank you for raising it 😅