[solved] Color display problem

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
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

[solved] Color display problem

Post by Bigfoot71 »

Hello, I'm writing on this forum because I'm starting to discover love2d but each time I have the same color display problem and I couldn't find other topics talking about it.

When I want to display gray (depending on the hues) it's only either white or black, no gray to display...

I'm not talking about the other colors and the alpha channel doesn't work either, whatever its value, everything is displayed as if the opacity is at 100%.

I thought I had a hardware problem but I tried my projects on several screens and always the same result... However, I also redid a piece of code almost identical with PyGame which worked but not with Love2D :( ...

If you know what this could be due to, I don't put any particular example because even a simple

Code: Select all

love.graphics.setColor( 0, 0, 0, 135 )
love.graphics.rectangle( "fill", 0, 0, window.w, window.h )
does not work.

I also tried with setBlendMode and many other "tweaks" but I had no results. Maybe I used it wrong...

Thank a lot !
Last edited by Bigfoot71 on Sat Apr 23, 2022 3:52 am, edited 1 time in total.
My avatar code for the curious :D V1, V2, V3.
User avatar
GVovkiv
Party member
Posts: 674
Joined: Fri Jan 15, 2021 7:29 am

Re: Color display problem

Post by GVovkiv »

love from 11(?) uses from 0-1, not 0-255
so in your case it should be something like

Code: Select all

love.graphics.setColor( 0, 0, 0, 0.5 )
https://love2d.org/wiki/love.graphics.setColor
User avatar
BrotSagtMist
Party member
Posts: 636
Joined: Fri Aug 06, 2021 10:30 pm

Re: Color display problem

Post by BrotSagtMist »

Bigfoot71 wrote: Fri Mar 25, 2022 3:38 am

Code: Select all

love.graphics.setColor( 0, 0, 0, 135 )
13500% invisible!
It covers your screen into a klingon deflection shield. :cool:
Joke aside, colour functions use floats not ints.
The reason being that screen tech is not limited to 8bit/256values anymore.
obey
User avatar
dusoft
Party member
Posts: 521
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Color display problem

Post by dusoft »

Bigfoot71 wrote: Fri Mar 25, 2022 3:38 am Hello, I'm writing on this forum because I'm starting to discover love2d but each time I have the same color display problem and I couldn't find other topics talking about it.
Also see this:
https://love2d.org/wiki/love.math.colorFromBytes

You can use that function to convert easily without doing any math yourself.
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Color display problem

Post by Bigfoot71 »

Excuse me for my absence, thank you for the explanation and for the function, I had not thought that we should apply it otherwise, thank you again ^^
My avatar code for the curious :D V1, V2, V3.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests