That function expects decimal for s (saturation) and v (value), not percent. Divide by 100.

>>> import colorsys

# Using percent, incorrect
>>> test_color = colorsys.hsv_to_rgb(359,100,100)
>>> test_color
(100, -9900.0, -9900.0)

# Using decimal, correct
>>> test_color = colorsys.hsv_to_rgb(1,1,1)
>>> test_color
(1, 0.0, 0.0)

If you would like the non-normalized RGB tuple, here is a function to wrap the colorsys function.

def hsv2rgb(h,s,v):
    return tuple(round(i * 255) for i in colorsys.hsv_to_rgb(h,s,v))

Example functionality

>>> hsv2rgb(0.5,0.5,0.5)
(64, 128, 128)
Answer from Cory Kramer on Stack Overflow
Top answer
1 of 9
64

That function expects decimal for s (saturation) and v (value), not percent. Divide by 100.

>>> import colorsys

# Using percent, incorrect
>>> test_color = colorsys.hsv_to_rgb(359,100,100)
>>> test_color
(100, -9900.0, -9900.0)

# Using decimal, correct
>>> test_color = colorsys.hsv_to_rgb(1,1,1)
>>> test_color
(1, 0.0, 0.0)

If you would like the non-normalized RGB tuple, here is a function to wrap the colorsys function.

def hsv2rgb(h,s,v):
    return tuple(round(i * 255) for i in colorsys.hsv_to_rgb(h,s,v))

Example functionality

>>> hsv2rgb(0.5,0.5,0.5)
(64, 128, 128)
2 of 9
27

If you like performance, it's best to avoid imports and use your own optimized code

Here's GIMP's code ported to python, tested at 99% acuracy, and improved for performance:
(this code happens to match colorsys almost exactly)

scalar = float # a scale value (0.0 to 1.0)
def hsv_to_rgb( h:scalar, s:scalar, v:scalar, a:scalar ) -> tuple:
    if s:
        if h == 1.0: h = 0.0
        i = int(h*6.0); f = h*6.0 - i
        
        w = v * (1.0 - s)
        q = v * (1.0 - s * f)
        t = v * (1.0 - s * (1.0 - f))
        
        if i==0: return (v, t, w, a)
        if i==1: return (q, v, w, a)
        if i==2: return (w, v, t, a)
        if i==3: return (w, q, v, a)
        if i==4: return (t, w, v, a)
        if i==5: return (v, w, q, a)
    else: return (v, v, v, a)

output:

>>> hsv_to_rgb( 359/360.0, 1.0, 1.0, 1.0 )
(1.0, 0.0, 0.016666666666666607, 1.0)

Using an if-chain like above is actually faster than using elif

Using a wrapper, like in Cyber's answer, takes a few extra steps for the interpreter to perform.
To add, the for loop in Cyber's example is a real performance killer when used like that

If you want slightly more performance, simply do this:
(I won't say this is the best possible performance, but it's certainly better)

scalar = float # a scale value (0.0 to 1.0)
def hsv_to_rgb( h:scalar, s:scalar, v:scalar, a:scalar ) -> tuple:
    a = int(255*a)
    if s:
        if h == 1.0: h = 0.0
        i = int(h*6.0); f = h*6.0 - i
        
        w = int(255*( v * (1.0 - s) ))
        q = int(255*( v * (1.0 - s * f) ))
        t = int(255*( v * (1.0 - s * (1.0 - f)) ))
        v = int(255*v)
        
        if i==0: return (v, t, w, a)
        if i==1: return (q, v, w, a)
        if i==2: return (w, v, t, a)
        if i==3: return (w, q, v, a)
        if i==4: return (t, w, v, a)
        if i==5: return (v, w, q, a)
    else: v = int(255*v); return (v, v, v, a)

^ this guarantees int() output with a range of 255 (the input is still the same)

>>> hsv_to_rgb( 359/360.0, 1.0, 1.0, 1.0 )
(255, 0, 4, 255)

NOTE: this code tests just as accurate as colorsys to GIMP (99% correct):

TIP: stay away from 3rd-party where possible, try the direct approach if you can.
exculusions: compiled C extensions such as PIL or NumPy, or ctypes wrappers such as PyOpenGL (uses the DLL)

🌐
Python
docs.python.org › 3 › library › colorsys.html
colorsys — Conversions between color systems
The colorsys module defines bidirectional conversions of color values between colors expressed in the RGB (Red Green Blue) color space used in computer monitors and three other coordinate systems: YIQ, HLS (Hue Lightness Saturation) and HSV (Hue Saturation Value).
🌐
Medium
scriptopia-official.medium.com › python-colorsys-convert-hsv-to-rgb-aaf27ef40186
Python Colorsys — Convert HSV to RGB - Scriptopia Official Medium - Medium
January 1, 2024 - Moving on we use the colorsys.hsv_to_rgb() function to convert the HSV values to their corresponding RGB values. The RGB values are obtained, each value is multiplied by 255 (to scale the values back to the 0-255 range for RGB representation).
🌐
GeeksforGeeks
geeksforgeeks.org › python › matplotlib-colors-hsv_to_rgb-in-python
Matplotlib.colors.hsv_to_rgb() in Python - GeeksforGeeks
July 12, 2025 - Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. The matplotlib.colors.hsv_to_rgb() function is used to convert hsv values to rgb.
🌐
GitHub
gist.github.com › mathebox › e0805f72e7db3269ec22
Python methods to convert colors between RGB, HSV and HSL · GitHub
@mathebox & @ArtemBernatskyy, According to https://en.wikipedia.org/wiki/HSL_and_HSV, add l = (high + low) / 2, and not low. ... def clamp(value, min_value, max_value): return max(min_value, min(max_value, value)) def saturate(value): return ...
🌐
Esri Community
community.esri.com › t5 › geoprocessing-questions › arcgis-python-hsv-to-rgb-colour-conversion › td-p › 1381428
ArcGIS python HSV to RGB colour conversion - Esri Community
May 8, 2026 - def colourHSVtoRGB(self,H,S,V): # The ArcGIS HSV model is strange - Hue 0-240, Saturation 0 - 255, Value 0 - 255 from matplotlib.colors import hsv_to_rgb # Convert hval to 360 and make it 0 - 1 hval = 3.6 * (H / 240) sval = S / 255 vval = V / 255 invals = [hval, sval, vval] rg = hsv_to_rgb(invals) R = rg[0] G = rg[1] B = rg[2] # Convert to 0 - 255 R = int(round((R * 255), 0)) G = int(round((G * 255), 0)) B = int(round((B * 255), 0))
Find elsewhere
🌐
Top Tech Boy
toptechboy.com › convert-hsv-to-rgb-in-micropython
Convert HSV to RGB in Micropython | Technology Tutorials
To make this a library, we save it as h2RGB.py on our Raspberry Pi Pico W. You can save it either in the same folder your main programs are in, or in the lib folder. To use the library, then simply import the file (h2RGB) and call the method h2RGB.getRGB(degrees), where degrees is the point ...
🌐
Tech-Artists.Org
tech-artists.org › t › convert-hsv-to-rgb › 13390
Convert HSV to RGB - python - Tech-Artists.Org
December 15, 2020 - Hello developers, I have an HSV ... import colorsys value_hsv = [8.67, 0.98, 0.63] value_rgb = colorsys.hsv_to_rgb(value_hsv[0], value_hsv[1], value_hsv[2]) print value_rgb[0]*255, ......
🌐
PyPI
pypi.org › project › HSV
HSV · PyPI
November 1, 2021 - from HSV.hsv import rgb_to_hsv, hsv_to_rgb if __name__ == '__main__': ONE_255 = 1.0 / 255.0 r, g, b = 25, 60, 128 print("\nOriginal RGB values (R:%s, G:%s, B:%s)\n" % (r, g, b)) h, s, v = rgb_to_hsv(r * ONE_255, g * ONE_255, b * ONE_255) print("HSV values (H:%s, S:%s, V:%s)" % (h * 360.0, s * 100.0, v * 100.0)) r, g, b = hsv_to_rgb(h, s, v) print("Retrieved RGB values (R:%s, G:%s, B:%s)\n" % (r * 255.0, g * 255.0, b * 255.0)) If you need to compile the Cython code after changing the files hsv.pyx or hsv.pxd or the external C code please proceed as follow: 1) open a terminal window 2) Go in the
🌐
Quora
quora.com › How-do-I-convert-a-color-value-from-HSV-to-RGB-in-OpenCV-Python
How to convert a color value from HSV to RGB in OpenCV Python - Quora
Quora is a place to gain and share knowledge. It's a platform to ask questions and connect with people who contribute unique insights and quality answers.
🌐
GitHub
github.com › TheAlgorithms › Python › blob › master › conversions › rgb_hsv_conversion.py
Python/conversions/rgb_hsv_conversion.py at master · TheAlgorithms/Python
def rgb_to_hsv(red: int, green: int, blue: int) -> list[float]: """ Conversion from the RGB-representation to the HSV-representation. The tested values are the reverse values from the hsv_to_rgb-doctests. Function "approximately_equal_hsv" is needed because of small deviations due to ·
🌐
ActiveState
code.activestate.com › recipes › 576554-covert-color-space-from-hsv-to-rgb-and-rgb-to-hsv
Covert color space from HSV to RGB and RGB to HSV « Python recipes « ActiveState Code
Do these differ from the functions in the colorsys module? http://www.python.org/doc/2.6/library/colorsys.html · >>> import colorsys >>> colorsys.hsv_to_rgb(.5,1,1) (0.0, 1.0, 1) >>> colorsys.rgb_to_hsv(.5,.5,0) (0.16666666666666666, 1.0, 0.5) Peter Law 15 years, 1 month ago # | flag ·
🌐
SunFounder
docs.sunfounder.com › projects › kepler-kit › en › latest › video_course › lesson34.html
Lesson 34: Convert HSV to RGB in Micropython — SunFounder Kepler Kit for Raspberry Pi Pico W 1.0 documentation
Algorithm Development: Creates a function to convert HSV to RGB values and sets up the RGB LED with PWM on the Raspberry Pi Pico W. Code Implementation: Walkthrough of Python code for PWM control and HSV to RGB conversion, including a library function.