svg-captcha
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -28,2 +28,9 @@ /** | ||
/** | ||
* default: false | ||
* if set to true, it will draw with light grey color | ||
* use if you have a site with dark theme | ||
* only active when color is set to false | ||
*/ | ||
inverse?: boolean; | ||
/** | ||
* default: '' | ||
@@ -30,0 +37,0 @@ * filter out some characters |
@@ -11,2 +11,4 @@ 'use strict'; | ||
const noiseLines = []; | ||
const min = options.inverse ? 7 : 1; | ||
const max = options.inverse ? 15 : 9; | ||
let i = -1; | ||
@@ -19,3 +21,3 @@ | ||
const mid2 = `${random.int((width / 2) - 21, (width / 2) + 21)} ${random.int(1, height - 1)}`; | ||
const color = hasColor ? random.color() : random.greyColor(); | ||
const color = hasColor ? random.color() : random.greyColor(min, max); | ||
noiseLines.push(`<path d="M${start} C${mid1},${mid2},${end}" stroke="${color}" fill="none"/>`); | ||
@@ -30,2 +32,4 @@ } | ||
const spacing = (width - 2) / (len + 1); | ||
const min = options.inverse ? 10 : 0; | ||
const max = options.inverse ? 14 : 4; | ||
let i = -1; | ||
@@ -40,3 +44,3 @@ const out = []; | ||
const color = options.color ? | ||
random.color(options.background) : random.greyColor(0, 4); | ||
random.color(options.background) : random.greyColor(min, max); | ||
out.push(`<path fill="${color}" d="${charPath}"/>`); | ||
@@ -43,0 +47,0 @@ } |
{ | ||
"name": "svg-captcha", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "generate svg captcha in node.js or express.js", | ||
@@ -19,3 +19,4 @@ "main": "index.js", | ||
"node captcha", | ||
"captcha generator" | ||
"captcha generator", | ||
"captcha alternative" | ||
], | ||
@@ -22,0 +23,0 @@ "author": { |
![svg-captcha](media/header.png) | ||
# svg验证码 | ||
# svg验证码 [![Build Status](https://travis-ci.org/lemonce/svg-captcha.svg?branch=master)](https://travis-ci.org/steambap/svg-captcha) | ||
[![Build Status](https://travis-ci.org/lemonce/svg-captcha.svg?branch=master)](https://travis-ci.org/steambap/svg-captcha) | ||
在node.js中生成svg格式的验证码 | ||
## Translations | ||
[中文](README_CN.md) | ||
[English](README.md) | ||
@@ -12,0 +10,0 @@ ## 什么情况下使用SVG验证码? |
![svg-captcha](media/header.png) | ||
# svg captcha | ||
# svg captcha [![Build Status](https://travis-ci.org/lemonce/svg-captcha.svg?branch=master)](https://travis-ci.org/steambap/svg-captcha) | ||
[![Build Status](https://travis-ci.org/lemonce/svg-captcha.svg?branch=master)](https://travis-ci.org/steambap/svg-captcha) | ||
generate svg captcha in node.js | ||
@@ -8,0 +6,0 @@ |
98287
316
111