# Code review: Modifying RGB by Manipulating HSV colors

**URL:** <https://forum.inductiveautomation.com/t/code-review-modifying-rgb-by-manipulating-hsv-colors/58295>\
**Category:** General Discussion\
**Tags:** ignition80\
**Created:** [April 11, 2022, 2:13pm UTC](https://forum.inductiveautomation.com/t/code-review-modifying-rgb-by-manipulating-hsv-colors/58295 "2022-04-11T14:13:46Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 12, 2022, 9:10pm UTC](https://forum.inductiveautomation.com/t/code-review-modifying-rgb-by-manipulating-hsv-colors/58295/4 "2022-04-12T21:10:18Z")

</div>

That’s fair. I would expect better performance out of a more Java-based solution, but it’s very likely not going to be enough to actually matter.

For posterity, a reimplementation of your method:

```auto
def mulColorV(rgbHex, factV):
	from com.inductiveautomation.ignition.common import TypeUtilities
	from java.awt import Color
	javaColor = TypeUtilities.getColorFromString(rgbHex)
	hsl = Color.RGBtoHSB(javaColor.red, javaColor.green, javaColor.blue, None)
	hsl[2] = max(0.0, min(hsl[2] * factV, 1.0))
	hslColor = Color.getHSBColor(*hsl)
	return "#" + TypeUtilities.colorToHex(hslColor)
	
mulColorV("#100000", 0.2)
mulColorV("#100000", 2.0) 

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/code-review-modifying-rgb-by-manipulating-hsv-colors/58295)._
