golang/freetype

what is the proper way of setting text color ?

zak905 opened this issue · 2 comments

I am trying to set the text color based on the example provided here. https://github.com/golang/freetype/blob/master/example/freetype/main.go

I don't see any code that explicitly sets the color of the text, except this:

ruler := color.RGBA{0xdd, 0xdd, 0xdd, 0xff}
	if *wonb {
		fg, bg = image.White, image.Black
		ruler = color.RGBA{0x22, 0x22, 0x22, 0xff}
	}

//... and then later

	// Draw the guidelines.
	for i := 0; i < 200; i++ {
		rgba.Set(10, 10+i, ruler)
		rgba.Set(10+i, 10, ruler)
	}

I tried this in my code, but it does not seem to change the color of the text. What is the proper way of doing so. Thanks.

var red = color.RGBA{255, 0, 0, 255}
....
fg, bg := image.NewUniform(red), image.White

Thanks I have figured in the meanwhile. Closing the issue