How do I determine darker or lighter color variant of a given color?

前端 未结 13 634
情话喂你
情话喂你 2020-12-04 07:37

Given a source color of any hue by the system or user, I\'d like a simple algorithm I can use to work out a lighter or darker variants of the selected color. Similar to effe

13条回答
  •  醉梦人生
    2020-12-04 08:16

    Rich Newman discusses HSL color with respect to .NET System.Drawing.Color on his blog and even provides an HSLColor class that does all the work for you. Convert your System.Drawing.Color to an HSLColor, add/subtract values against the Luminosity, and convert back to System.Drawing.Color for use in your app.

提交回复
热议问题