Page 1 of 1

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

Posted: Mon Jan 11, 2016 8:39 pm
by 1029chris
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://love2d.org/imgmirrur/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.

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

Posted: Mon Jan 11, 2016 8:42 pm
by Nixola
You should set the color back to 255,255,255 before drawing the canvas.

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

Posted: Mon Jan 11, 2016 9:59 pm
by 1029chris
Nixola wrote:You should set the color back to 255,255,255 before drawing the canvas.
Thank you! You fixed it.