$User.UITheme and $User.UIThemeDisplayed

These global merge fields identify the Salesforce look and feel a user sees on a given Web page.

The difference between the two variables is that $User.UITheme returns the look and feel the user is supposed to see, while $User.UIThemeDisplayed returns the look and feel the user actually sees. For example, a user may have the permissions to see the new user interface theme look and feel, but if they are using a browser that doesn’t support that look and feel, for example, older versions of Internet Explorer, $User.UIThemeDisplayed returns a different value.

Usage

Use these variables to identify the CSS used to render Salesforce web pages to a user. Both variables return one of the following values.
  • Theme1—Obsolete Salesforce theme
  • Theme2Salesforce theme used before Spring ’10
  • Theme3—Classic “Aloha” Salesforce theme, introduced in Spring ’10
  • PortalDefaultSalesforce Customer Portal theme
  • WebstoreSalesforce AppExchange theme
Note

Note

$User.UITheme and $User.UIThemeDisplayed return the value “Theme3” in Lightning Experience and Salesforce1, which isn’t correct. The behavior of $User.UITheme and $User.UIThemeDisplayed in this context may change in a future release.

Example

The following example shows how you can render different layouts based on a user’s theme:
<apex:page>
    <apex:pageBlock title="My Content" rendered="{!$User.UITheme == 'Theme2'}">
        // this is the old theme...
    </apex:pageBlock>

    <apex:pageBlock title="My Content" rendered="{!$User.UITheme == 'Theme3'}">
       // this is the classic theme ...
    </apex:pageBlock>
</apex:page>
Previous
Next