Development

Quick Theming for the Next Experience

This article covers the high points of creating user-selectable themes when enabling San Diego’s Next Experience. While this mostly covers…

This article covers the high points of creating user-selectable themes when enabling San Diego’s Next Experience.   While this mostly covers color selection for themes, it should also relate to other theme style properties.  See ServiceNow documentation for more detail.

You can also use this information to create variant styles (which will show as theme selections for users) within the default “Polaris” theme.

Note: San Diego patch 1 or later is needed for all these steps to work.

Workspaces:  The author experienced mixed success with this method in workspaces.  At times, such as on longer page loads, the workspace UI would go back to the Polaris default, and the preferred theme would have to be chosen again by deselecting and then reselecting it in the Theme preferences.

Create a new Theme

Now Experience Framework > Themes > Theme Management > Themes

(FYI, one of the themes listed is “Polaris,” the default theme for the Next Experience.  We are going to override that in a later step.)

  • Click “New.”

UI shows 'Themes' selected in a left-hand navigation menu, with an arrow pointing to a 'New' button in the main content area.

  • Give it a name and click “Save”

UX Theme form: Name AAA Custom, Application Global, Active checked, Domain global. Tabs: Compositional: App Theme, Legacy:…

Create a new Style record for the new Theme

  • On the new Theme record’s “Compositional: App Theme” related list, click on “Style” and click its magnifying glass.

UX Theme form: AAA Custom. Shows Style field with search icon.

  • In the pop-up window that displays, search for UX Styles named “Colors.”  If there is more than one listed by that name, filter the list for:  ‘Package’ starts with ”sn-themes,” then select “Colors.”

UX Styles list shows 'Colors' with Type 'Core' under a search for Package Name starting with 'sn-themes'.

  • When the pop-up window closes, click the green “Save” button to keep the selection.

Input field 'Colors' with search icon, and a highlighted 'Save (Enter)' button.

  • Save the theme so the style will be kept on it.

Pop-up menu with 'Save' highlighted. Options include Insert and Insert and Stay.

  • Click on the “Colors” style to open it up.

UI element: 'Colors' style selected in a table row with 'Core' type.

  • Right-click and select “Insert and Stay” to make your own copy of the Colors UX style.

Dropdown menu with 'Insert and Stay' highlighted.

  • Now it’s time to customize.

    • Name: You may change this to easily recognize this style record.

    • Style field:  Don’t be overwhelmed by the long JSON file.  Just updating one or two colors can have a big impact.  These two lines might be good starters in the “base” section at the top:

“ - now-color_chrome - brand”

“ - now-color_chrome - divider”

You can search for RGB color codes online to find the values for the colors you want.

UX Style Red form with 'Red' name field and JSON code showing color variables.

NOTE:  The code must remain properly formatted for JSON, or a blank page with no frame may show if this style is used.

  • Click “Update” to save the file and return to the Theme.

UI buttons: settings icon, three dots, 'Update' button, 'Delete' button.

  • Back on the Theme, the default Colors style is still listed, but not the one that you just updated.  Double-click in the row below the “Colors” style to locate and add your new color style.  Click the green arrow.

UX Theme Styles table: 'Red' style selected with checkmark icon.

  • Then remove the original Colors style that was copied by clicking the red “x” for its row.   (This will not delete the style from the system, but only remove it from this theme.)

Red delete button next to 'Colors' style in UX Theme Styles table.

  • Save the Theme to keep the changes.

Menu with 'UX Theme' title. 'Save' option is highlighted.

  • Your custom style should be the only style listed.

UX Theme Styles table: Red style, Core type, updated 2023-03-01. Insert new row.

NOTE:  This example uses your custom style as the “Core” style for this theme, but you could have left the Colors style in place as “Core” and added the new style as a “Variant.”  More information on that is below after the “Refresh your browser” step.

  • Get the sys_id of the theme to prepare for the next step.

Dropdown menu with 'Copy sys_id' highlighted. Options include Save, Insert, Configure, Export, View.

Create a system property entry for the custom theme

This will make the theme’s “core” style become the default for all users.

  • On the sys_properties list, open a new entry

Name = glide.ui.polaris.theme.custom

Value = sys_id copied from the Theme record

  • Click Save

System Property form: Name 'glide.ui.polaris.theme.custom', Value 'bc8e...'.

Refresh your browser

After refreshing your browser, the system should use the new theme instead of the Polaris theme because of the system property that was added.

System property form with Name field set to glide.ui.polaris.theme.custom.

  • You may notice that there is no Theme selection visible in the Preferences.  This is because at this point there is only one Style listed in the new Theme.

Preferences dialog with options for Display, Accessibility, Notifications, and Debugging.

  • To provide theme selections for users:  Add other styles to your theme, but as Type = “Variant.”  Do not forget to save the Theme record after you have added Style entries to it.  You can also add existing variants to your theme, such as the Dark variant.  (Note: The Dark theme only works when the system property “glide.ui.polaris.dark_themes_enabled” is set to “true.”)

UX Theme AAA Custom form. Save button highlighted. UX Theme Styles table shows Blue variant.

  • The Theme selection should then appear under Preferences, and your default and variant should appear as theme selections.  You can add multiple variants.

Preferences menu with Display, Theme, Accessibility, and Notifications options. Theme is highlighted.

Theme selection screen showing Default (red) and Blue variants.

BONUS INFORMATION

There are other properties you can set up.   For instance, if you want to hide the wavy background pattern used by Polaris, add this to the JSON properties of your style:

“ - now-unified-nav_menu - background-image-alpha”: “0”

Don’t forget that if you add this as done below, you’ll need to add a comma at the end of the previous line.

JSON code showing property '--now-unified-nav-menu--background-image-alpha': '0

Before (with pattern showing):

UI showing 'Themes' selected under 'Service Portal' in a navigation menu.

After (with pattern hidden):

UI navigation menu with 'Themes' highlighted under 'Service Portal'.

That’s all for this article.  Happy Theming!