Message: 'module' object has no attribute 'CreateColor'

When I run the following I get an error message.

import rhinoscriptsyntax as rs
rs.CreateColor([50,50,50], g=None, b=None, a=None)

Exception Occured
Message: ‘module’ object has no attribute 'CreateColor’
Traceback points to line 2.

I’m running Rhino for Mac v5.3.3 (5D197) on Sierra 10.12.6

Any ideas what it could be?

There is no rs.CreateColor() method as far as I know… You are thinking of rs.coercecolor() maybe? --Mitch

It’s in the documentation here.
coerceColor() is not in the documentation, doesn’t show up with code hinting, and when I run it a similar error message appears.

@markgtaber, that’s the documentation for Rhino 6. This seems to work in Rhino 6:

import rhinoscriptsyntax as rs
color = rs.CreateColor(50,50,50)

this should work in Rhino 5 Win & Mac:

import System
from System.Drawing import Color
color = Color.FromArgb(50,50,50)


That works. Thanks!

We have made changes in this area.

rs.CreateColor() was added to the Rhino 6 code stream. The Color.FromArgb() is from Ironpythons support of .NEt and the rs.coercecolor() is from the old RHino 5 Rhinoscript syntax.

All 3 of these methods result in a System.Drawing.Color.

The rs.CreateColor() will be the standard call in the future that is documented in RhinoScriptSyntax. The other two will continue to work/