Tag Archives: Theme

Identify Salesforce User Experience Theme in Visualforce Page

We can use User.UITheme and User.UIThemeDisplayed in Visualforce Page to determine User Experience Theme.

User.UITheme : Returns the theme that is supposed to be used.
User.UIThemeDisplayed : Returns the theme that is actually being used.

User.UITheme and User.UIThemeDisplayed will return following values.

  • Theme1—Obsolete Salesforce theme
  • Theme2—Salesforce Classic 2005 user interface theme
  • Theme3—Salesforce Classic 2010 user interface theme
  • Theme4d—Modern “Lightning Experience” Salesforce theme
  • Theme4t—Salesforce mobile app theme
  • Theme4u—Lightning Console theme
  • PortalDefault—Salesforce Customer Portal theme
  • Webstore—Salesforce AppExchange theme

Sample Code:

<apex:page>
    <apex:pageBlock title="Theme">
        {!$User.UITheme}
        {!$User.UIThemeDisplayed}
    </apex:pageBlock>
</apex:page>