Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Get current interface color [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 250 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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)
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          Yannick,

          That's the one.

          Thanks,

          Chris

          1 Reply Last reply Reply Quote 0
          • First post
            Last post