Color code

Hello,

I use RhinoScript into c# and I have the color code problem

rs.ObjectColor(surface, [150,0,0]);

For some reason the color code is rong, what is the rigth code for this command?
the color code should be a list with the 3 RGB channels, But how can I pass this list using
the RhinoScript on C#

Thanks

Hi @MatrixRatrix, have you tried like below ?

color = System.Drawing.Color.FromArgb(150, 0, 0)
rs.ObjectColor(surface, color) 

_
c.

Hello @clement ,

I try you comand and dont work, seams that “rs.ObjectColor(surface, color)” only acept Int number.

I think the issue is that you made your RGB values a list when they should be a tuple. This works for me:

rs.ObjectColor(surface, (150,0,0))

Hope this helps,

Dan

@DanBayn, thank you,

this code " rs.ObjectColor(surface, (150,0,0))" work for me to, but is on Python editor, I not using
the Python editor.

I using C# with rhinoscript plugin:

var rhinoscript_object = RhinoApp.GetPlugInObject(“RhinoScript”);
var rs = (IRhinoScript)rhinoscript_object;

var surface= rs.GetObject(“Select part”, 8);
rs.ObjectColor(surface, (150,0,0))

So, on C# this list dont work.

How about rs.ObjectColor(surface, Array(150,0,0)) ?

@Helvetosaur , dont work ,

Only work if the command is “rs.ObjectColor(a, 16744272);”,

I can not identify the integer type matches the color “16744272”, is a decimal but,
here is the table for decimal color?

http://www.shodor.org/stella2java/rgbint.html

C = 256^2* R + 256* G + B;

??

Sorry, I missed that in your original post.

I also seem to remember using RGB(150,0,0) from Rhinoscript days…