Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5892

HSL to RGB conversion via RhinoCommon or (rhinoscriptsyntax)

$
0
0

@Helvetosaur wrote:

I can't seem to get this to work. rhinoscriptsyntax wants different stuff from RhinoCommon, but I can't get either of them working...

import rhinoscriptsyntax as rs
import Rhino

count=5
hsl_colors=[Rhino.Display.ColorHSL(i/(count-1),1,1) for i in range(count)]
for color in hsl_colors: print "H={}, S={}, L={}".format(color.H,color.S,color.L)

rgb_colors=[Rhino.Display.ColorHSL.ToArgbColor(color) for color in hsl_colors]
for color in rgb_colors: print "R={}, G={}, B={}".format(color.R,color.G,color.B)

Result:

H=0.0, S=1.0, L=1.0
H=0.25, S=1.0, L=1.0
H=0.5, S=1.0, L=1.0
H=0.75, S=1.0, L=1.0
H=1.0, S=1.0, L=1.0
R=255, G=255, B=255
R=255, G=255, B=255
R=255, G=255, B=255
R=255, G=255, B=255
R=255, G=255, B=255

What am I doing wrong here?

Thanks,
--Mitch

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5892

Trending Articles