c# finding similar colors

后端 未结 6 850
滥情空心
滥情空心 2021-01-05 16:39

I want to call a method with argument color. But there are a lot of colors which differ only by a shade. How can I find the colors which differ from my color only by little,

6条回答
  •  一个人的身影
    2021-01-05 17:28

    I think to find similar colors you should take a look at the HSL or HSB color space instead of the RGB one, cause with this it is a lot easier to find similar colors.

    Within .Net you can call the GetHue(), GetSaturation() and GetBrightness() method to get these values from a given color and compare these values to find similar ones.

    If you need the way back from an HSB value to a color you can also use this method.

提交回复
热议问题