So, while trying my game in the latest version of love2d there's some color 'issues' caused by the latest version due to the fact I'm still using values from 0-255.
At first I thought it would be easy, just adding /255 to each love.setColor call. And then I remembered I have a huge dictionary filled with 'material design' colors. Obviously, adding /255 manually is too much of a hassle.
Here's the dictionary
One of the ways I thought of fixing this is with notepads regex functionality and just use a regex expression to find all the hexadecimal values and add /255 next to them. Sadly, I have no idea how to do that. I've found some regex expressions for finding hexadecimal values but I have no idea how to make it so I can add /255 to the end of each of them.
Any help would be appreciated!
Fixing color 'issues' brought in by 11.0
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Ducktor Cid
- Prole
- Posts: 18
- Joined: Wed Oct 05, 2016 8:08 pm
Re: Fixing color 'issues' brought in by 11.0
Code: Select all
for c, ct in pairs ( colors ) do
for v, vt in pairs ( ct ) do
for i = 1, #v do
v[ i ] = v[ i ] / 255
end
end
end
- NotARaptor
- Citizen
- Posts: 59
- Joined: Thu Feb 22, 2018 3:15 pm
Re: Fixing color 'issues' brought in by 11.0
In Notepad++ (it's probably similar in other editors) you can do a regex search/replace easily enough.
Search : (0x[0-9a-f][0-9a-f])
Replace : \1/255
That would work nicely on your dictionary file - for more general use-cases you'd need to make a better regexp - that one would for example see "0x1234" and match the first two hex characters, and the result would be "0x12/25534". But for your file it will be fine
Search : (0x[0-9a-f][0-9a-f])
Replace : \1/255
That would work nicely on your dictionary file - for more general use-cases you'd need to make a better regexp - that one would for example see "0x1234" and match the first two hex characters, and the result would be "0x12/25534". But for your file it will be fine
- Ducktor Cid
- Prole
- Posts: 18
- Joined: Wed Oct 05, 2016 8:08 pm
Re: Fixing color 'issues' brought in by 11.0
Thanks Raptor!
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 3 guests