Does the .Net Color struct use an HSB or HSL colour space?

前端 未结 1 450
有刺的猬
有刺的猬 2021-01-02 07:22

As I understand it HSL and HSB colour spaces are very similar, both use the same 0-360 colour wheel for hue and the same 0-1 value for saturation. The one difference between

相关标签:
1条回答
  • 2021-01-02 08:12

    The page you linked to gives examples of L and V (aka B) for a range of colours. Comparing the result of Color.FromArgb(255, 255, 0, 0).GetBrightness (0.5) to the examples shows that .NET is using the HSL model. A check of Color.FromArgb(255, 128, 255, 255).GetSaturation (1.0) confirms it.

    Others have discovered the same thing, e.g. Chris Jackson (MSFT) in Converting from HSB to RGB in .NET: "The underlying issue is that the .NET Framework refers to the color space as HSB even though it actually is HSL. (The color picker control refers to it correctly.) The Color structure in the framework provides a GetBrightness() method, described in the documentation as, "Gets the hue-saturation-brightness (HSB) brightness value for this Color structure." Is this wrong? You bet. It should be called GetLuminance()."

    0 讨论(0)
提交回复
热议问题