Made use of a new style name feature and implemented a dark style, and now by default light version is being rendered.
This commit is contained in:
parent
504a8d137f
commit
a3faf8b9c9
@ -29,11 +29,19 @@ func (c *DwellingCaptcha) generateImage(style string) *image.Image {
|
||||
ctx := gg.NewContext(dwImageWidth, dwImageHeight)
|
||||
|
||||
// fill background
|
||||
if style == "dark" {
|
||||
ctx.SetRGB255(0x0a, 0x0a, 0x0a)
|
||||
} else {
|
||||
ctx.SetRGB255(0xf5, 0xf5, 0xf5)
|
||||
}
|
||||
ctx.Clear()
|
||||
|
||||
// draw text
|
||||
if style == "dark" {
|
||||
ctx.SetRGB255(0xf5, 0xf5, 0xf5)
|
||||
} else {
|
||||
ctx.SetRGB255(0x0a, 0x0a, 0x0a)
|
||||
}
|
||||
ctx.Scale(4.0, 2.7)
|
||||
ctx.DrawStringAnchored(string(c.GetAnswer()), 20, 5, .5, .5)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user