Does anyone know how to create two new colours (highlight and shadow) based on one colour in ActionScript 3? So, if I have red (0xFF0000), I will get a light red and dark red too?
I have no idea. Thanks!
CodePudding user response:
To get Highlight (lightness) you increase each R, G and B equally by same amount (with maximum at 255
or 0xFF
). In your case Red is already at its maximum so increase both Green and Blue by same amount (eg do a = 128
on each of those channels).
To get Shadow (darkness) you decrease each R, G and B equally by same amount (with minimum at 0
or 0x00
). In your case both Green and Blue are already at their minimum so just decrease only Red by x amount (eg do a -= 128
on Red channel).
In short:
Input = 0xFF0000
... then Highlight = 0xFF8080
and Shadow = 0x800000
.