Merge pull request #6016 from todbot/rainbowio-255p5-fix

fix #6015: rainbowio error for input > 255.0 < 256.0
This commit is contained in:
Scott Shawcroft 2022-02-11 09:32:15 -08:00 committed by GitHub
commit 34092437ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,5 +42,6 @@ int32_t colorwheel(mp_float_t pos) {
shift2 = 0;
}
int p = (int)(pos * 3);
p = (p < 256) ? p : 255;
return (p << shift1) | ((255 - p) << shift2);
}