Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
how can i determine if a color belongs to a certain group?

i want to build a color picker that picks color from the screen.

but i dont want my program to return the hex value but i want it to return color's name. let's say someone picks the color "#272829" now to us humans this looks like the color black. so i want it to return "the color is black"

here is an example of the colors which i want to be considered the color "black"

enter image description here

in that picture i want that all those colors that i've marked to be "black", so if someone picks one of these colors it will say "the color is black"

how can i accomplish that ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you want to achieve this by yourself, an idea to solve this could be using RGB color codes instead of hex values. As the three arguments define the amount of each color (Red, Green and Blue) you can try to guess which color is picked by doing something like this :

  • if (R === 255 && G === 0 && B === 0) : color is red
  • if (R === 0 && G === 255 && B === 0) : color is green
  • if (R === 0 && G === 0 && B === 255) : color is blue
  • if (R === 0 && G === 0 && B === 0) : color is black
  • if (R === 0 && G === 0 && B === 0) : color is white

This is the main idea, then, you can adjust condition for each color amount to handle all cases :

  • if (R >= 200 && R < 255 && G > 0 && G < 50 && B > 0 && B < 50) : color is red
  • ...

Otherwise, there are some tools to do this : https://chir.ag/projects/ntc/

Hope this would help you!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!