Page MenuHome

python api - python hsv values inconsistent with color picker values
Closed, InvalidPublic


Blender Version
Blender 2.78a and Blender 2.77a

Short description of error
converted HSV values in python API are inconsistent with the displayed color picker values

Exact steps for others to reproduce the error
In python console:

import bpy, colorsys = colorsys.hsv_to_rgb(0.5, 0.5, 0.5)


from mathutils import Color
import bpy
c = Color()
c.hsv = (0.5, 0.5, 0.5) = c

Both code snippets displays the HSV values: (0.5, 0.27, 0.735) in the color picker.



Event Timeline

Brecht Van Lommel (brecht) closed this task as Invalid.

There are multiple ways to do HSV to RGB conversion, and it also depends on the color space (sRGB, linear, ..).

colorsys is a module part of Python itself which uses a different formula than Blender, we don't consider that to be a bug.

Thank you for the reply!

When printing out the value of, the output value is also inconsistent for the hsv values for the horizon color in the color picker.
Is the mathutils.Color class also inconsistent with the color conversion in Blender?

The HSV value edited in the color picker is in display space (sRGB by default). The values in the API are in scene linear space.