Search Unity

Detect the Unity Editor Skin Dark or Light?

Discussion in 'Immediate Mode GUI (IMGUI)' started by greggman, May 24, 2016.

  1. greggman

    greggman

    Joined:
    Nov 30, 2013
    Posts:
    24
    I've got a plugin using the default colors but it's also using Rich Text and <color> tags. Can I detect if I'm on light or dark so I can update the colors to something that will be readable?

    For example blue is readable on the light theme but not on the dark theme so I'd switch colors in that case.

    At the moment I get EditorStyles.label.normal.textColor and check if any values are > 0.5 If so I assume it's dark, otherwise light. Is there a more "official" way?
     
  2. IzzySoft

    IzzySoft

    Joined:
    Feb 11, 2013
    Posts:
    376
    I use EditorGUIUtility.isProSkin.

    example: