Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

253
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda