diff --git a/internal/captcha/dwelling_captcha.go b/internal/captcha/dwelling_captcha.go index 82110d5..a5eb7d0 100644 --- a/internal/captcha/dwelling_captcha.go +++ b/internal/captcha/dwelling_captcha.go @@ -26,10 +26,11 @@ func NewDwellingCaptcha(expiry time.Duration) *DwellingCaptcha { } func (c *DwellingCaptcha) generateImage(style string) *image.Image { + isDark := style == "dark" ctx := gg.NewContext(dwImageWidth, dwImageHeight) // fill background - if style == "dark" { + if isDark { ctx.SetRGB255(0x0a, 0x0a, 0x0a) } else { ctx.SetRGB255(0xf5, 0xf5, 0xf5) @@ -37,7 +38,7 @@ func (c *DwellingCaptcha) generateImage(style string) *image.Image { ctx.Clear() // draw text - if style == "dark" { + if isDark { ctx.SetRGB255(0xf5, 0xf5, 0xf5) } else { ctx.SetRGB255(0x0a, 0x0a, 0x0a)