# Is color math supported?

**URL:** <https://forum.electromage.com/t/is-color-math-supported/544>\
**Category:** Uncategorized\
**Created:** [September 6, 2020, 12:44am UTC](https://forum.electromage.com/t/is-color-math-supported/544 "2020-09-06T00:44:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jeff](https://forum.electromage.com/user_avatar/forum.electromage.com/jeff/32/3473_2.png) [@jeff](https://forum.electromage.com/u/jeff)\
**Post date:** [September 6, 2020, 4:55pm UTC](https://forum.electromage.com/t/is-color-math-supported/544/2 "2020-09-06T16:55:36Z")

</div>

Hey Chris!

I think the code you need can be easily adapted from my “Crossfading” pattern in the [pattern library](https://electromage.com/patterns/) (see top of page 2). Is uses an [HSV-to-RGB conversion function](https://forum.electromage.com/t/hsv-to-individual-r-individual-g-inividual-b-funstions/193) to blend multiple patterns by summing RGB components in the way you describe.

I’ve also put some thought into blending HSV directly, by envisioning each as a vector in [cylindrical HSV space](https://upload.wikimedia.org/wikipedia/commons/4/4e/HSV_color_solid_cylinder.png) and doing vector addition. I think this might be feasible and less math for faster results in just per-pixel blending.

I didn’t pursue it yet for computing gradients, because the math to compute some desirable paths smoothly (through black/white, around the wheel) involved quaternion math to do [slerp](https://en.wikipedia.org/wiki/Slerp#:~:text=In%20computer%20graphics%2C%20Slerp%20is,purpose%20of%20animating%203D%20rotation.).

---

_[View the full topic](https://forum.electromage.com/t/is-color-math-supported/544)._
