Documentation ¶
Index ¶
- Constants
- type Config
- type Options
- func SetBackgroundHexColor(backgroundHexColor string) Options
- func SetCodeType(codeType string) Options
- func SetDevMode(devMode bool) Options
- func SetFontHexColor(fontHexColor string) Options
- func SetHeight(height int) Options
- func SetLineHexColors(lineHexColors []string) Options
- func SetWidth(width int) Options
- type Theme
Constants ¶
const ( UppercaseEnglishCharacters = "uppercaseEnglishCharacters" NumericCharacters = "numericCharacters" MixedCharacters = "mixedCharacters" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Width int Height int BackgroundHexColor string FontHexColor string LineHexColors []string Code string CodeType string DevMode bool }
func (*Config) CustomCode ¶
CustomCode @Description: Users can use their own generated characters as the verification code, the custom code will be capitalized and then used. Therefore, when validating code, you must use all uppercase code. @receiver c @param code: Customize the generated verification code, but the length limit of 4 digits needs to be met. The custom code will be capitalized and then used. Therefore, when validating code, you must use all uppercase code. @return *Config
func (*Config) GenerateGif ¶ added in v1.0.1
GenerateGif @Description: Generate gif @receiver c @return gifBase64Data @return code @return err
type Options ¶
type Options func(*Config)
func SetBackgroundHexColor ¶
SetBackgroundHexColor @Description: Set the background color of the captcha image @param backgroundHexColor: Background color, only hex can be used @return Options
func SetCodeType ¶
SetCodeType @Description: Set the type of random validation characters, which takes effect only if the user is not using custom code @param codeType: Use one of the built-in types: UppercaseEnglishCharacters, NumericCharacters, MixedCharacters @return Options
func SetDevMode ¶
SetDevMode @Description: In the development mode, the generated image is saved as a local file for easy viewing @return Options
func SetFontHexColor ¶
SetFontHexColor @Description: Set the font color of the captcha image @param fontHexColor: Font color, only hex can be used @return Options
func SetHeight ¶
SetHeight @Description: Set the height of the captcha image, which is 120 by default @param height @return Options
func SetLineHexColors ¶
SetLineHexColors @Description: Set the line color of the captcha image, a minimum of 3 colors need to be set, and the line will randomly get 3 colors from them to draw @param lineHexColors: Font colors, only hex can be used, a minimum of 3 colors need to be set @return Options