Theming
TaskOn widgets use a two-layer token system:
- Seed tokens: base inputs (brand colors, radius, font size)
- Map tokens: final resolved tokens used by UI
Resolution priority:
map override > derived from seed > defaultBasic Usage
import { ThemeProvider } from "@taskon/widget-react/core";
<ThemeProvider
theme={{
mode: "dark",
seed: {
colorPrimary: "#2563eb",
borderRadius: 10,
},
}}
>
{children}
</ThemeProvider>Default mode is
darkwhen notheme.modeis set.
Seed Tokens (Input)
Common seed tokens:
colorPrimarycolorSecondarycolorSuccesscolorWarningcolorErrorcolorLinkcolorTextcolorTextOnPrimarycolorBgBaseborderRadiusfontSize
Map Tokens (Output)
Common map tokens:
colorPrimary,colorPrimaryHover,colorPrimaryActive,colorPrimaryBgcolorBgCanvas,colorBgSurface,colorBgSurfaceSubtle,colorBgFloatingcolorText,colorTextSecondary,colorTextDisabledcolorBorder,colorBorderSecondaryfontSize,fontSizeSm,fontSizeLgspacing,spacingSm,spacingMd,spacingLg
Light/Dark Split Config
<ThemeProvider
theme={{
mode: "auto",
light: { seed: { colorPrimary: "#2563eb" } },
dark: { seed: { colorPrimary: "#60a5fa" } },
}}
>
{children}
</ThemeProvider>Cloud Theme and themeMode
Widgets that support widgetId can load theme from TaskOn cloud config.
You can still override mode on the widget instance:
<QuestWidget widgetId={123} themeMode="light" />
<QuestWidget widgetId={123} themeMode="dark" />
<QuestWidget widgetId={123} themeMode="auto" />themeMode applies to:
QuestWidgetCommunityTaskListLeaderboardWidgetUserCenterWidget
CSS Variables
All resolved tokens are exposed as CSS variables with --taskon- prefix:
colorPrimary -> --taskon-color-primary
borderRadius -> --taskon-border-radius
colorBgCanvas -> --taskon-color-bg-canvas
colorText -> --taskon-color-textExample:
.my-button {
background: var(--taskon-color-primary);
border-radius: var(--taskon-border-radius);
color: var(--taskon-color-text);
}Compact Mode
<ThemeProvider theme={{ compact: true }}>
{children}
</ThemeProvider>Last updated on