相关依赖、代码等一切资源如有侵犯到任何人的任何权益,请及时联系作者删除,抱歉(感谢)!
生成svg标签字符串
本项目仅为了学习以下技能,无法保证生产环境是否可靠,请慎用!
- svg标签
- opentype.js
- rollup
- package.json文件配置
- npm publish
- 开源版权协议(看了下太复杂,已放弃,若本项目无版权纠纷则所有人亦可无条件使用)
npm i my-captcha-svg
import captchaBuilder, {ICaptcha} from 'my-captcha-svg'
captchaBuilder.setConfig({
bgColor: "#e9e1e1",
length: 4,
baseX: 5,
baseY: 37,
height: 40,
width: 150,
fontSize: 48,
offsetX: 35,
color: "#3dacc2",
fontUrl: 'font-url',
noiseColor: "#bb1e1e",
noiseNum: 3,
noiseWidth: 0.7,
excludeChar: "i1l0oOe",
})
const captcha: ICaptcha = captchaBuilder.create()
console.log(captcha.text, captcha.svg)
- 本项目参考svg-captcha编写,需要验证码的朋友建议直接出门左转更安全~