Get current interface color [SOLVED]

On 13/05/2015 at 17:21, xxxxxxxx wrote:

I'm trying to match my GeUserArea color to the current interface color.

I've tried:

color = c4d.GeGetGray()
self.background_color = Vector(color['x'] / 255.0, color['y'] / 255.0, color['z'] / 255.0)
  
and
            
colid = c4d.VIEWCOLOR_C4DBACKGROUND
self.background_color = c4d.GetViewColor(colid)

...but neither one matches.

How do you get it?

Thanks,

Chris

On 14/05/2015 at 02:10, xxxxxxxx wrote:

Hi Chris,

GeGetGray() returns the default Cinema gray color. It's not meant for the GUI but for bitmaps, materials, textures i.e. rendering.

GetViewColor() returns only colors for the viewport system.

To get a GUI color from inside a GeUserArea call self.GetColorRGB() with the color ID to retrieve e.g. c4d.COLOR_BG for the background color of Cinema interface. Note the returned value is a dict so you have to build a color vector and divide each value by 255.0 as you have done in your  GeGetGray() example.

In Init():

bg = self.GetColorRGB(c4d.COLOR_BG)
self.backcolor = c4d.Vector(bg['r']/255.0, bg['g']/255.0, bg['b']/255.0)

In DrawMsg():

self.DrawSetPen(self.backcolor)

On 14/05/2015 at 21:09, xxxxxxxx wrote:

Yannick,

That's the one.

Thanks,

Chris