Change Material color picker from HSV input to RGB input or convert RGB color to HSV color via Code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
TLDR: I am experiencing an issue with entering RGB color values via code, as the default color picker in use is based on the HSV color model. This has led to the colors not appearing accurate as they are not being accurately translated between the two color models.
I have an external source that dictates a color value that is in RGB(0-255). I have a python tool that creates the shader and assigns it to the geometry required. The issue here is that I have a value in RGB say (115,115,115) and when I plug this using " cmds.setAttr("{}.color".format(material_name, 115,115,115, type = "double3") ", it will plug this value as HSV and as a result, Saturation in HSV(which is capped between 0-1) and Value ends up with an extreme level of 115. When I manually assign these values by clicking on color picker and changing the color model from HSV to RGB(0-255), it works. How can I modify the above code to change color model from HSV to RGB before assigning values? Or is there a converter that works and can convert RGB color values into HSV colors?
I did try some RGB to HSV tools but they usually have the same issue where Saturation and Value in HSV are more than 1.
Thanks in advance.