Overview
Section titled “Overview”Hub embeds offer three color schemes: "light", "dark", and "system" (which is the default). It’s important to choose the value that best matches the
behavior of the page you are embedding into.
How to update the Hub Color Scheme setting
Section titled “How to update the Hub Color Scheme setting”You can update the color scheme setting in the Hub app in the Page, Widget, or Portal design settings for your Workspace. This will update the value for all embedded <released-page> or <released-widget> elements respectively for that Workspace, or for that Workspace’s Portal in the Product Hub.
If you have a specific widget or page that is embedded into a different context, you can add the color-scheme="{light|dark|system}" attribute to that element to override the value you’ve set in the Workspace settings. For example, to st a single Announcement Page to use the Light color scheme:
<released-page color-scheme="light" (other attributes)></released-page>Light, Dark, and System/Auto - which setting do I want?
Section titled “Light, Dark, and System/Auto - which setting do I want?”Which Hub Color Scheme you choose depends on how your page handles the native browser color-scheme values for your users. Specifically, it depends on how your page interacts with:
- Your user’s
prefers-color-schemeCSS media feature, which describes whether the user has configured their browser to prefer a dark or light color scheme. - The HTML document’s
color-schemeCSS property which describes the actual color-scheme the document is using. Technically, we only look at thecolor-schemevalue on the<released-page>or<released-widget>element itself, but this is usually inherited and consistent across the whole document.
| Color scheme | HTML attribute value | Use this value if… |
|---|---|---|
| Light | light |
|
| Dark | dark |
|
| Auto | system |
|
Specific examples
Section titled “Specific examples”At night, my Announcement Page header text looks white on a white background
Section titled “At night, my Announcement Page header text looks white on a white background”This happens because:
- Your operating system or browser:
- may be using an Automatic color scheme. It sets
prefers-color-schemeto"light"during the day, and"dark"at night.
- may be using an Automatic color scheme. It sets
- The page where you’ve embedded Hub:
- uses a white background at all times,
- does not use a
prefers-color-schememedia query to change the background if the user prefers a dark color scheme, - does not set a
color-scheme: lightCSS value to indicate that it is using a Light color scheme.
- Your Workspace Page Color Scheme is set to “Auto” (if the user’s
prefers-color-schemeis"dark") or “Dark”.
You should set your Workspace Page Color Scheme to “Light” to match the behavior of your web page.
When users choose my app’s Dark color scheme, the Hub Announcement Page header text looks black on a black background
Section titled “When users choose my app’s Dark color scheme, the Hub Announcement Page header text looks black on a black background”This happens because:
- The user’s operating system or browser:
- may be using a Light or Automatic color scheme and has currently set
prefers-color-schemeto"light".
- may be using a Light or Automatic color scheme and has currently set
- The page where you’ve embedded Hub:
- uses a black background for this user,
- does not set a
color-scheme: darkCSS value to indicate that it is using a Dark color scheme.
- Your Workspace Page Color Scheme setting is set to “Auto” (if the user’s
prefers-color-schemeis"light") or “Light”.
You should either:
- Begin applying the
color-schemeCSS property to match your users’ Dark Mode choices and set your Workspace Page Color Scheme to “Auto” to match the behavior of your web page. - Add an explicit
color-schemeattribute to your<released-page>element that matches the current user’s choice of light or dark color scheme.