#How to get the closest color to the input rgb value?
19 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @shrewd junco! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
define a bunch of color names with their respective rgb values, compare r, g and b for each name to your input, return the one with the least difference
found this code on stack overflow that finds the closest color from name, using a mean square error:
there also exists this javascript code here that finds the closes named color:
https://www.color-blindness.com/color-name-hue-tool/js/ntc.js
note: this would need to be translated to java
that is not even valid java
I can't try it out rn because my IDE doesn't wanna open atm, but they said that it may not compile, so ¯_(ツ)_/¯
yeah wait wtf is happening in that class https://cdn.discordapp.com/emojis/774466411250319410.webp?size=48&name=poob&quality=lossless
lemme quickly make it smth more reasonable
there, that's significantly better (actually works and uses decent code style), and it also has more colours