Workspace themes with color-picking

Starting in Workspace 5.0, you can customize the colors of the user interface components used in Browser by defining a color theme. With Workspace 5.5, the use of themes includes Home and Storefront.

You can define and register a theme for a workspace platform. If you don't define a theme, you get a default palette.

Colors can be specified in the following ways:

  • Hexadecimal, not case specific, 3 (#F0F) or 6 characters (#FF00FF)
  • HSL/HSLA
  • RGB/RBGA
  • CSS color names — optional color properties only

The backgroundPrimary color property must be specified using a numeric format (that is, not a name); otherwise errors are thrown.

If a user's system contains multiple workspace platforms, each Workspace application (Browser, Home, and Storefront) retains the theme of the workspace platform it was opened with, until closed or changed. Therefore, the user's screen may show Workspace windows with different themes, depending on which workspace platform created each window.

Simple theming

The most straightforward way to define a theme is to define only the required properties:

  • brandPrimary
  • brandSecondary
  • backgroundPrimary

All other properties then either are generated based on these color values or use default colors.

The properties background1 to background6 are generated based on backgroundPrimary. Internally, the backgroundPrimarycolor is translated into HSL format, and then other shades are generated by varying the saturation and lightness values. The following diagram shows how shades are generated based on the color red, which has a hue value of 352.

12301230

Diagram of light and dark auto-generated color values

The generated values are used to provide depth for visual components, such as for drop shadows. Workspace selects between light shades and dark shades, depending on the operating system's color mode.

Other colors are generated from brandPrimary and brandSecondary. These include colors for active, hover, focused, and text.

Code example

const wp = WorkspacePlatform.init({
…
  theme: [
    {
      label: 'MyTheme',
      palette: {
        brandPrimary: '#0661DC',  // Hexadecimal, 3 or 6 digits
        brandSecondary: rgb(170, 136, 166) , // RGB, optional: rgba()
        backgroundPrimary:  hsl(3, 23%, 17%)  // HSL, optional: hsla()
      }
    }
  ],
});

UI mappings of required properties

Here are examples of the color properties that are required to be defined in a theme. In the screen shots, the color property is set to vermillion (#D55E00).

  • brandPrimary
    Example: dialog box default button background
848848

A dialog box with the default button (Close Window) colored vermillion

  • brandSecondary
    Example: dialog box other button background
846846

A dialog box with a non-default button (Cancel) colored vermillion

  • backgroundPrimary
    Example: Used to generate background2, used in Browser page title bar background, focussed/selected view tab
994994

The top of a window with the title bar and active view tab background colored vermillion

Advanced theming

If you prefer, you can specify additional color properties, rather than using generated or default colors. For optional properties, you can use CSS named colors instead of numeric definitions.

background2:  'rebeccapurple'

Here are examples of optional color properties. In the screen shots, the color property is set to vermillion (#D55E00). For a complete list of properties, refer to the Workspace Platform API reference.

  • inputBackground
    Example: background for value of Save As dialog box
534534

Dialog box for Save As ... with background for value colored TODO

  • background1
    Example: Browser view title bar background
988988

The top of a window, with the inactive view tab and view tab area colored vermillion

  • background2
    Example: Browser page title bar background, focussed/selected view tab
994994

The top of a window with the title bar and active view tab colored vermillion

  • background4
    Example:
    • focussed toolbar button
524524

The OpenFin toolbar, showing the Hide Tabs icon selected and colored vermillion

  • sub-toolbar background
630630

The OpenFin toolbar, with the color linking sub-toolbar displayed and its background colored vermillion

  • dialog background
538538

The Save page dialog box, with the background colored vermillion

  • background5
    Example: Back button in search
13241324

The Back button from Search colored TODO

  • background6
    Examples:
    • Browser sub-toolbar outline
316316

The OpenFin toolbar with the Change Layout sub-toolbar displayed, with the outline of the sub-toolbar colored vermillion

  • dialog box outline
862862

A dialog box with its outline colored vermillion

  • statusActive
    Example: Selected page tab background
11861186

The top of a window, where the active page tab background is colored vermillion

  • inputColor
    Example: input box text and caret color
516516

The Save page dialog box, with the entered text and caret colored vermillion

  • inputFocused
    Example: Outline around selected text box
496496

The Save page dialog box, with the focussed text field outlined in vermillion

  • textDefault
    Examples:
  • Browser title bar icons & controls, selected view tab text
12521252

The top of a window, with the OpenFin toolbar and window control icons and the selected view tab label text colored vermillion

  • Dialog box message text
848848

A dialog box, with the message text colored vermillion

  • textHelp
    Example: Browser unselected view tab text
708708

The top of a window, with the unselected view tab label colored vermillion


Did this page help you?