## Is there a way to change font color?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
zine92
Prole
Posts: 6
Joined: Wed Mar 17, 2010 4:33 am

### Is there a way to change font color?

i wanted to change the color of the font displayed. Because i loaded a white background image and i decided to trace the mouseX and mouseY, but since text is is white, i cannot see properly. So is there anyway to change the font color. thanks.

bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

### Re: Is there a way to change font color?

Everything is drawn using the foreground color, so use love.graphics.setColor.

zine92
Prole
Posts: 6
Joined: Wed Mar 17, 2010 4:33 am

### Re: Is there a way to change font color?

i try using set color and this make my whole game screen black which covers the image. This is what i typed

Code: Select all

mouseX = love.mouse.getX()
mouseY = love.mouse.getY()
love.graphics.setColor(0,0,0,255)
love.graphics.setFont(50)
love.graphics.print("X: "..mouseX, 100, 100)
love.graphics.print("Y: "..mouseY, 400, 100)
and

Code: Select all

mouseX = love.mouse.getX()
mouseY = love.mouse.getY()
love.graphics.setColor(255,255,255,255)
love.graphics.setFont(50)
love.graphics.print("X: "..mouseX, 100, 100)
love.graphics.print("Y: "..mouseY, 400, 100)
Attachments
Screenshot-2.png (291.12 KiB) Viewed 5500 times
Screenshot-1.png (323.03 KiB) Viewed 5500 times

bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

### Re: Is there a way to change font color?

setColor colors the images as well, oh and stop using setFont(<size>) in love.draw, it creates a font every single frame.

zine92
Prole
Posts: 6
Joined: Wed Mar 17, 2010 4:33 am

### Re: Is there a way to change font color?

okay. thanks.

nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

### Re: Is there a way to change font color?

bartbes wrote:setColor colors the images as well
Unless you change colormode from modulate to replace.

### Who is online

Users browsing this forum: Kindermaus and 21 guests