Last active
September 6, 2018 22:42
-
-
Save arkag/12b486097e035d4093d6531cee7082a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Color mod_color(Color change, bool add, uint16_t modifier) { | |
| uint16_t addlim = 359 - modifier; | |
| uint16_t sublim = modifier; | |
| uint16_t leftovers; | |
| if (add) { | |
| if (change.h <= addlim) { | |
| change.h += modifier; | |
| } else { | |
| leftovers = modifier - (359 - change.h); | |
| change.h = 0 + leftovers; | |
| } | |
| } else { | |
| if (change.h >= sublim) { | |
| change.h -= modifier; | |
| } else { | |
| leftovers = modifier - change.h; | |
| change.h = 359 - leftovers; | |
| } | |
| } | |
| return change; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment