Issue With Line Colors, Help Please!

Hi, I am trying to make lines with different colors. I have the 2076 build. A lot of colors are not showing properly with the corresponding RGB values. For example this code is suppose to create a red line when I tap on the screen, but it instead creates a yellow one:

function onTouch() line=display.newLine(10, 10, 300, 700) line.width=30 line:setColor(232, 27, 0, 255) line.blendMode="normal" end Runtime:addEventListener("tap", onTouch)

If I change the RGB values to a different shade of red (255, 62, 70), the line is white colored. This is not only happening with the color red, but to all other colors as well. Is this a bug? I didn’t have this problem in my old build (before I updated to 2076). Please enlighten me. Thank you!

Colors with the Graphics 2.0 engine are in a range of 0 to 1, instead of 0 to 255.  A simple solution is to divide  your color by 255:

line:setColor(232/255, 27/255, 0/255, 255/255)

Of course, the last two dont need it:

line:setColor(232/255, 27/255, 0, 1)

Wow thanks for the quick and helpful reply! I really appreciate it! Thank you very much, Rob!

Was line:setColor() not also changed to line:setStrokeColor(), and line.width changed to line.strokeWidth?

Yes indeed it was. You can still use setColor or width but it will give you a warning message.

Colors with the Graphics 2.0 engine are in a range of 0 to 1, instead of 0 to 255.  A simple solution is to divide  your color by 255:

line:setColor(232/255, 27/255, 0/255, 255/255)

Of course, the last two dont need it:

line:setColor(232/255, 27/255, 0, 1)

Wow thanks for the quick and helpful reply! I really appreciate it! Thank you very much, Rob!

Was line:setColor() not also changed to line:setStrokeColor(), and line.width changed to line.strokeWidth?

Yes indeed it was. You can still use setColor or width but it will give you a warning message.