Color from HSL

Is there any way in python or dynamo to assign colors by Hue, as opposed to RGB? I checked the developer’s guide, but nothing with with “HSL” or “hue” appeared to existing with a search.

Hi @jameshitt,

Here is a solution with a package for HSL colors :

You could also use the colorsys module in Python.

import clr
import colorsys

from DSCore import *

h = IN[0]/360.0
l = IN[1]/100.0
s = IN[2]/100.0

r,g,b = colorsys.hls_to_rgb(h,l,s)
r,g,b = [x*255.0 for x in r,g,b]

OUT = Color.ByARGB(255,r,g,b)