Correct System.Windows.Forms.ControlPaint.HSLColor.Darker function #12586
Labels
api-suggestion
(1) Early API idea and discussion, it is NOT ready for implementation
untriaged
The team needs to look at this issue in the next triage
Background and motivation
At least since .NET Framework 4, the
System.WIndows.Forms.ControlPaint.HSLColor.Darker
function (which is called bySystem.Windows.Forms.ControlPaint.Dark()
) has been wrong for non-system colors.The
Lighter
function logically interpolates, based on the passed percentage value, from the current luminosity towards a luminosity value 50% higher. TheDarker
function illogically interpolates, based on the passed percentage value, from a luminosity value 33% lower than the current luminosity towards zero.A call to
Lighter(0)
reasonably returns the same color. A call toDarker(0)
unreasonably returns a color 33% darker.Lighter(0.5)
returns a color 25% lighter;Darker(0.5)
returns a color 67% darker.Lighter(1)
returns a color 50% lighter;Darker(1)
returns black.API Proposal
API Usage
Alternative Designs
No response
Risks
No response
Will this feature affect UI controls?
Yes.
The text was updated successfully, but these errors were encountered: