[SOLVED]setColor doesn't seem to be setting the right colors

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
1029chris
Prole
Posts: 3
Joined: Mon Dec 14, 2015 10:41 pm

[SOLVED]setColor doesn't seem to be setting the right colors

Post by 1029chris » Mon Jan 11, 2016 8:39 pm

I'm using love.graphics.setColor(192, 192, 192) on various things in my project, but they all seem to be different shades of grey despite being set this same color. https://i.imgur.com/CiUAFT5.png Here's an image showing the situation.

Here's the code for the panel on the bottom.

Code: Select all

function drawStart()
  love.graphics.setColor(192, 192, 192)
  love.graphics.rectangle("fill", panel.x, panel.y, panel.width, panel.height) --Draw box
  love.graphics.setColor(220, 220, 220)
  love.graphics.setLineWidth(2)
  love.graphics.line(panel.x, panel.y, panel.width, panel.y) -- Draw shine
  love.graphics.setColor(150, 150, 150)
  love.graphics.rectangle("line", panel.s.x, panel.s.y, panel.s.width, panel.s.height) -- Draw start outline
  love.graphics.setColor(70,70,70)
  love.graphics.print("START", panel.s.x+4, panel.s.y+7) -- print START
end
Here's the code for the "start menu" I'm still working on.

Code: Select all

function drawMenu()
  love.graphics.setCanvas(start.cvs)
  love.graphics.setColor(192, 192, 192)
  love.graphics.rectangle("fill", 0, 0, 250, 350) -- Draw main box
  love.graphics.setColor(220, 220, 220)
  love.graphics.setLineWidth(4)
  love.graphics.line(0, 0+350, 0, 0, 0+250, 0) --BoxLight
  love.graphics.setColor(150,150,150)
  love.graphics.line(0, 0+350, 0+250, 0+350, 0+250, 0) --BoxShadow
  love.graphics.setColor(0,0,120)
  love.graphics.rectangle("fill", 0, 0, 30, 350) -- Draw blue bar
  love.graphics.setColor(192, 192, 192)
  love.graphics.setCanvas()
  love.graphics.draw(start.cvs, 0, 600-30-350-1) -- Draw canvas
end
Why isn't it setting the color right despite having the exact same values in setColor? The "Chat" menu is also drawn in a canvas.
Last edited by 1029chris on Mon Jan 11, 2016 10:00 pm, edited 1 time in total.

User avatar
Nixola
Inner party member
Posts: 1941
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: setColor doesn't seem to be setting the right colors.

Post by Nixola » Mon Jan 11, 2016 8:42 pm

You should set the color back to 255,255,255 before drawing the canvas.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics

1029chris
Prole
Posts: 3
Joined: Mon Dec 14, 2015 10:41 pm

Re: setColor doesn't seem to be setting the right colors.

Post by 1029chris » Mon Jan 11, 2016 9:59 pm

Nixola wrote:You should set the color back to 255,255,255 before drawing the canvas.
Thank you! You fixed it.

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests