Documentssuperset
Dashboard Color Scheme
Dashboard Color Scheme
Type
Topic
Status
Published
Created
Jul 27, 2026
Updated
Jul 27, 2026
Created by
Dosu Bot
Updated by
Dosu Bot

Dashboard Color Scheme#

Overview#

Dashboard color schemes in Apache Superset control how categorical colors are assigned across all charts on a dashboard. Color settings live at two levels: dashboard-level (in json_metadata) and chart-level (in each slice's params column). The dashboard-level settings take precedence over chart-level settings during rendering.

Storage#

Dashboard-level (json_metadata)#

The Dashboard model stores all color-related metadata in its json_metadata column. The following keys are written and normalized by DashboardDAO.set_dash_metadata:

KeyTypeDescription
color_schemestrActive categorical color scheme name
color_namespacestrNamespace for color isolation between dashboards
color_scheme_domainlist[str]Domain values for the active color scheme
label_colorsdictUser-defined per-label color overrides
shared_label_colorslist[str]Labels that appear in multiple charts (shared colors)
map_label_colorsdictFull label→color map derived from the color scheme

A dedicated update_colors_config method provides a targeted update path for just these five color keys without touching other metadata.

The frontend TypeScript type for these fields is defined in DashboardInfo.metadata.

Chart-level (slice params)#

Each Slice model stores chart config in a params column , exposed as the form_data property. A chart's color_scheme field inside params is the chart's own color scheme, carried through the rendering pipeline as own_color_scheme.

Color Scheme Fallback & Application#

Fallback hierarchy#

When a chart is opened in Explore from a dashboard context, getFormDataWithDashboardContext resolves the effective color scheme:

dashboardColorScheme || ownColorScheme → applied color_scheme
  • If the dashboard has a color_scheme set, it wins.
  • If not, the chart's own color_scheme (from its params) is used.
  • own_color_scheme is always preserved in form data alongside dashboard_color_scheme so the chart's individual setting is never discarded.

Explore chart hydration#

In hydrateExplore, a verifyColorScheme check runs on startup. If the chart's saved color_scheme no longer exists in the scheme registry, it falls back to the registry's default — supersetColors for categorical charts, superset_seq_1 for sequential.

Dashboard rendering pipeline#

Color info flows through three stages when rendering charts inside a dashboard:

  1. On loadDashboardContainer calls applyDashboardLabelsColorOnLoad(dashboardInfo.metadata) to seed stored colors into the CategoricalColorNamespace.

  2. Per-chart form data mergegetFormDataWithExtraFilters merges dashboard-level color fields (label_colors, map_label_colors, shared_label_colors, color_scheme) into each chart's form data on every render. The chart's own scheme is passed as own_color_scheme. Results are memoized per chart to avoid unnecessary re-renders .

  3. Color namespace isolationapplyColors orchestrates actual color assignment into the CategoricalColorNamespace. The color_namespace key creates a per-dashboard namespace instance so multiple open dashboards don't bleed colors into each other . getColorNamespace normalizes falsy values to undefined to fall back to the global namespace.

Label color synchronization#

shared_label_colors tracks which labels appear in more than one chart. map_label_colors is the full persisted color map. Custom per-label overrides in label_colors are applied last and always win over scheme-derived colors. SyncDashboardState writes all color context to localStorage under DashboardExploreContext , making it available to Explore when launched from within a dashboard tab.

Editing Color Schemes#

  • Properties Modal (PUT /api/v1/dashboard/{id}): The color scheme picker is rendered via ColorSchemeControlWrapper, which imports applyColors and getColorNamespace from src/utils/colorScheme and calls them immediately on submit before the server responds.
  • Direct JSON editing: The Properties Modal's Advanced section exposes the raw json_metadata editor for programmatic field manipulation .

Key Files#

FileRole
superset/daos/dashboard.pyset_dash_metadata — canonical write of all color keys
superset/daos/dashboard.pyupdate_colors_config — targeted color-only update
superset-frontend/src/utils/colorScheme.tsapplyColors, resetColors, refreshLabelsColorMap, getColorNamespace
superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.tsMerges dashboard color context into each chart's form data
superset-frontend/src/explore/controlUtils/getFormDataWithDashboardContext.tsFallback logic: dashboard scheme overrides chart own scheme
superset-frontend/src/explore/actions/hydrateExplore.tsColor scheme existence check / fallback at Explore load
superset-frontend/src/dashboard/components/gridComponents/Chart.jsxExtracts ownColorScheme from slice form_data
superset-frontend/src/dashboard/components/SyncDashboardState/index.tsxSyncs color context to localStorage for Explore cross-tab access
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.tsxTriggers applyDashboardLabelsColorOnLoad on mount