当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.d.ts 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
Weilin Shi 提交于 2017-03-04 10:42 . [ADDED] support for inverse color
/**
* config captcha generation options
*/
declare class ConfigObject {
/**
* width of captcha
*/
width?: number;
/**
* height of captcha
*/
height?: number;
/**
* captcha text size
*/
fontSize?: number;
/**
* random character preset
*/
charPreset?: string;
/**
* default: false
* if false, captcha will be black and white
* otherwise, it will be randomly colorized
*/
color?: boolean;
/**
* 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: ''
* filter out some characters
*/
ignoreChars?: string;
/**
* default: 1
* number of noise lines
*/
noise?: number;
/**
* default: white
* background color of svg image
*/
background?: string;
}
/**
* result of captcha generation
*/
interface CaptchaObj {
/**
* the captcha text,
* store this in your session
*/
text: string,
/**
* the svg image in string,
* set type of image/svg before send to client side
*/
data: string
}
/**
* This method returns a object that has two props:
* data: svg image string
* text: captcha text
*/
export function create(options?: ConfigObject): CaptchaObj;
/**
* This method returns a object that has two props:
* data: svg image string
* text: captcha text
* note that this method generate a math expression
* this means that text is the result of the math expression
*/
export function createMathExpr(options?: ConfigObject): CaptchaObj;
/**
* Override the default font with your own
*/
export function loadFont(url: string): void;
/**
* captcha generation global setting
*/
export const options: ConfigObject;
/**
* return a random string
*/
export function randomText(size): string;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化