Configuration options for decoy characters scattered across the captcha background.

Decoy characters are random characters placed throughout the captcha image to confuse OCR systems and automated solvers. They appear as background noise and significantly improve security by making it harder to identify the actual text. The number of decoy characters is automatically calculated based on canvas size.

Example: Basic Decoy Configuration

const decoyOptions: SetDecoyOptions = {
color: 'gray',
font: 'Arial',
size: 20,
opacity: 0.5
};

captcha.setDecoy(decoyOptions);

Example: High Security Decoys

const secureDecoys: SetDecoyOptions = {
color: 'darkgray',
size: 25,
opacity: 0.7 // More visible for higher security
};
interface SetDecoyOptions {
    color?: string;
    font?: string;
    size?: number;
    opacity?: number;
}

Properties

color?: string

Decoy text color (CSS color string, default: '#646566')

font?: string

Font family for decoy characters (default: 'Sans')

size?: number

Font size for decoy characters in pixels (default: 20)

opacity?: number

Decoy text opacity from 0 to 1 (default: 0.8)