0

I wanted to change specific range of color to another color.

For instance, i want to change all shades of yellow color to white.

Sauce
  • 3
  • 3
  • 2
    No, but it sure makes it easier. –  Dec 14 '22 at 01:40
  • No, it's not neccessary. Sure, it would be much easier to do in HSL color space than in RGB color space, but it's not impossible to do so in RGB color space either. Therefore the answer to your question is "no". –  Dec 14 '22 at 01:40
  • May i ask is there any reference by using only RGB? Im kinda confused. – Sauce Dec 14 '22 at 02:46
  • I'm afraid that is actually not a 'very specific' range of colors. – TaW Dec 14 '22 at 03:32
  • colour is one thing, and numeric representation of colour is a different thing. You can do all maths conversion you want, and because the two representations are equivalent, it doesn't matter which one do you use. Just RGB is not the most intuitive colour representation (but for some screens). – Giacomo Catenazzi Dec 14 '22 at 07:55

1 Answers1

0

The main problem here is defining what "all shades of yellow" mean. Working in HSL space this is fairly easy, define a range of Hues that you consider to be "yellow", and apply your change to all of these colors. For example:

HSL_yellow_to_white

Working in RGB space you will need to consider a RGB cube and define part of this volume as "yellow" before applying your transformation. This will likely be more difficult.

You might also want to keep part of the original color, for example keeping the Lightness-part of the color and only changing the saturation, so that a dark murky yellow will remain dark. You might also want to define a "soft border", and apply only part of your transformation, to avoid any sharp transitions between "yellow" and "not yellow".

JonasH
  • 28,608
  • 2
  • 10
  • 23