Opened 9 hours ago
Last modified 7 hours ago
#19396 assigned enhancement
Add HSP colors to rgb_color — at Initial Version
Reported by: | nephele | Owned by: | nephele |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | Kits/Interface Kit | Version: | R1/Development |
Keywords: | Cc: | pulkomandy | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
rgb_color should obtain an API to set it's brightness in addition to how it is now received.
This would require to internally convert to HSP, adopt the passed in Brightness, and convert back to rgb.
example api: rgb_color::SetBrightness(float brightness) (0-1) HSP system: http://alienryderflex.com/hsp.html
Example problem (With current HSL api):
hsl_color normalViewColor = hsl_color::from_rgb(viewColor); rgb_color failureColor = ui_color(B_FAILURE_COLOR); hsl_color newViewColor = hsl_color::from_rgb(failureColor); if (normalViewColor.lightness < 0.15) newViewColor.lightness = 0.15; else if (normalViewColor.lightness > 0.95) newViewColor.lightness = 0.95; else newViewColor.lightness = normalViewColor.lightness; viewColor = newViewColor.to_rgb();
New api:
rgb_color failureColor = ui_color(B_FAILURE_COLOR); if (viewColor.Brigthness() < 0.15) failureColor.SetBrightness(0.15); else if (viewColor.Brigthness() > 0.95) failureColor.SetBrightness(0.95); else failureColor.SetBrightness(viewColor.Brigthness()); viewColor = failureColor;
Example api with clamp values:
rgb_color failureColor = ui_color(B_FAILURE_COLOR); failureColor.SetBrightness(viewColor.Brigthness(), 0.15, 0.95); viewColor = failureColor;
Note:
See TracTickets
for help on using tickets.