![]() |
|
Closest Color Match - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Prolific Programmers (https://qb64phoenix.com/forum/forumdisplay.php?fid=26) +---- Forum: SMcNeill (https://qb64phoenix.com/forum/forumdisplay.php?fid=29) +---- Thread: Closest Color Match (/showthread.php?tid=4341) |
Closest Color Match - SMcNeill - 01-18-2026 This here is one of those tools that was so damn simple to make, and one which I think I could've used a bazillion times in the past. I have to wonder why the heck I haven't made something like this earlier. GAHHH!!! Anywho, here is the amazing color matcher! Code: (Select All)
As you can see, this chooses 10 random colors from us. Then it runs those 10 random colors against the list of 270 colors which are our color constants. Then it tells you which of the color constants are the closest match to your specific color. Then it draws you a box so you can compare with your own eyes how close the match is to the original color. And I'll let the results speak for themselves! Edit: Updated to optomize with the changes as suggested below. Edit: Also updated to use STxATxIC's large list of gathered colored names from across the interweb. It's almost 10,000 names in the list so it's pretty comprehensive and does a good job at matching colors extremely closely to one of these many given names. RE: Closest Color Match - Pete - 01-18-2026 I thought you did make this, or something very similar, a couple of years back. Pete
RE: Closest Color Match - SMcNeill - 01-18-2026 (01-18-2026, 04:12 AM)Pete Wrote: I thought you did make this, or something very similar, a couple of years back. Well, I has... but finding the damn thing after the old forums crashed and I've swapped out drives and replaced laptops... It's gone and lost and GAH!! I probably haven't had it since I shared something similar to it here all those years ago. I think what you're thinking of is the 32-bit color to 256 color convertor which basically does this to try and make a 32-bit color image display best on a 256 color palette. This is very similar to that, except it just asks for a single color and then finds the best match in an array of colors (Palette) and tells you which one is the closest match. The one does the whole palette, this lets you look for individual matches as you see fit.
RE: Closest Color Match - Pete - 01-18-2026 Or... Maybe this thread: https://qb64phoenix.com/forum/showthread.php?tid=3416&pid=31620#pid31620 That's not a matcher It's a picker An A.S.C.II kicker It picks out colors when it's run...
RE: Closest Color Match - a740g - 01-18-2026 I was improving the 8bpp dithering code last week after the discussion with Tony on Discord and I ended up writing a similar color matching function in C. I did some tiny optimization in my code. You can exit the loop early if dist = 0. That would mean an exact match, and we do not need to continue the search. Also, the target color components can be split outside the loop. Code: (Select All)
RE: Closest Color Match - SMcNeill - 01-18-2026 Updated with changes suggested by @a740g Also uploaded STxATxIC's collected list of color names and values from across the web. Close to 10,000 color names to compare against to find the one closest to a suitable match for whatever color value you might compare it against. |