Skip to main content

Design tokens

Every Cn* component reads exclusively from the Nextcloud CSS-variable system — no hardcoded colors, no app-specific tokens. The same component renders correctly in vanilla Nextcloud, in NL Design System themed apps, and in apps with custom themes — all by changing the variable values, not the components.

This page documents the CSS variables you can rely on when overriding component styles, building custom components, or tuning a theme. Categories follow the order Nextcloud's own theming app exposes them: primary colors, backgrounds, general colors, state colors, and element structure.

Theming, not overriding

When you need to restyle a component, set the appropriate variable on a parent container — never override component CSS directly. Component CSS targets these variables; setting them propagates the change to every descendant Cn* and Nc* component.

Primary color variables

VariableExampleUsage
--color-primary#00679eMain accent color configured by the user/admin
--color-primary-text#ffffffText color to be used on --color-primary
--color-primary-hover#3285b1Hover variant of --color-primary
--color-primary-light#e5eff5Lighter variant for secondary actions
--color-primary-light-text#00293fText color to be used on --color-primary-light
--color-primary-light-hover#dbe4eaHover variant of --color-primary-light
--color-primary-element#00679eAccessibility-adjusted primary for interactive elements
--color-primary-element-text#ffffffText color to be used on --color-primary-element
--color-primary-element-text-dark#f5f5f5Less contrast text variant for --color-primary-element
--color-primary-element-hover#005a8aHover variant of --color-primary-element
--color-primary-element-light#e5eff5Light variant for secondary interactive elements
--color-primary-element-light-text#00293fText color to be used on --color-primary-element-light
--color-primary-element-light-hover#dbe4eaHover variant of --color-primary-element-light
--gradient-primary-backgroundlinear-gradient(40deg, ...)Gradient using the primary color
--primary-invert-if-brightnoCSS filter to invert icons when primary background is bright
--primary-invert-if-darkinvert(100%)CSS filter to invert icons when primary background is dark

Background variables

VariableExampleUsage
--color-background-plain#00679ePlain background color (body element)
--color-background-plain-text#ffffffText color to be used on --color-background-plain
--color-background-hover#f5f5f5Background color for hover states
--color-background-dark#edededBackground for selected or emphasized elements
--color-background-darker#dbdbdbBackground for highlighted elements (not for text backgrounds)
--color-main-background#ffffffPrimary background color
--color-main-background-rgb255,255,255RGB values of --color-main-background for use in rgba()
--color-main-background-translucentrgba(..., .97)Near-opaque translucent variant of the main background
--color-main-background-blurrgba(..., .8)Semi-transparent variant of the main background for blurred surfaces
--gradient-main-backgroundvar(--color-main-background) 0%, ...Gradient fading from main background to transparent
--image-backgroundurl('...')Optional background image set by theming
--filter-background-blurblur(25px)Blur filter value for frosted glass surfaces
--background-invert-if-darknoCSS filter to invert icons on dark backgrounds
--background-invert-if-brightinvert(100%)CSS filter to invert icons on bright backgrounds
--background-image-invert-if-brightnoCSS filter to invert background images on bright backgrounds

General color variables

VariableExampleUsage
--color-main-text#222222Primary text color
--color-text-maxcontrast#6b6b6bAccessible subdued text with sufficient contrast
--color-text-maxcontrast-default#6b6b6bDefault value of --color-text-maxcontrast before any override
--color-text-maxcontrast-background-blur#595959Contrast-adjusted text color for use on blurred backgrounds
--color-text-lightvar(--color-main-text)Deprecated — use --color-main-text instead
--color-text-lightervar(--color-text-maxcontrast)Deprecated — use --color-text-maxcontrast instead
--color-scrollbarrgba(34,34,34, .15)Scrollbar color
--color-placeholder-light#e6e6e6Light placeholder color for inputs
--color-placeholder-dark#ccccccDark placeholder color for inputs
--color-border#edededStandard border color
--color-border-dark#dbdbdbDarker border variant
--color-border-maxcontrast#7d7d7dHigh-contrast border color for accessibility
--color-loading-light#ccccccBright portion of the loading spinner
--color-loading-dark#444444Dark portion of the loading spinner
--color-box-shadow-rgb77,77,77RGB values of the shadow color for use in rgba()
--color-box-shadowrgba(..., 0.5)Standard box shadow color

State color variables

VariableExampleUsage
--color-error#DB0606Error state color
--color-error-rgb219,6,6RGB values of --color-error for use in rgba()
--color-error-hover#df2525Hover variant of --color-error
--color-error-text#c20505Text color for error messages
--color-warning#A37200Warning state color
--color-warning-rgb163,114,0RGB values of --color-warning for use in rgba()
--color-warning-hover#8a6000Hover variant of --color-warning
--color-warning-text#7f5900Text color for warning messages
--color-success#2d7b41Success state color
--color-success-rgb45,123,65RGB values of --color-success for use in rgba()
--color-success-hover#428854Hover variant of --color-success
--color-success-text#286c39Text color for success messages
--color-info#0071adInformational state color
--color-info-rgb0,113,173RGB values of --color-info for use in rgba()
--color-info-hover#197fb5Hover variant of --color-info
--color-info-text#006499Text color for info messages
--color-favorite#A37200Color for favorite/starred elements

Element structure variables

Typography, sizing, spacing, animation timings, and layout dimensions. Use the spacing primitives (--default-grid-baseline, --border-radius-*) for any new layout work to stay consistent with the Nextcloud shell.

VariableExampleUsage
--font-facesystem-ui, -apple-system, ...UI typeface stack
--default-font-size15pxBase font size
--default-line-height24pxBase line height
--default-grid-baseline4pxBase spacing unit — multiply for consistent spacing
--animation-quick100msDuration for quick transitions
--animation-slow300msDuration for complex transitions
--border-radius3pxStandard corner rounding
--border-radius-large10pxIncreased corner rounding
--border-radius-roundedcalc(...)Pronounced rounding, computed from clickable area
--border-radius-element8pxRounding for interactive elements such as buttons and inputs (since NC30)
--border-radius-pill100pxFull pill-shaped rounding
--border-width-input1pxBorder width for input elements
--border-width-input-focused2pxBorder width for focused input elements
--default-clickable-area34pxDefault size of interactive (clickable) elements
--clickable-area-large48pxLarge variant of the clickable area
--clickable-area-small24pxSmall variant of the clickable area
--header-height50pxHeight of the main navigation bar
--header-menu-item-height44pxHeight of navigation menu entries
--header-menu-profile-item-height66pxHeight of the profile menu entry
--navigation-width300pxWidth of the app navigation sidebar
--sidebar-min-width300pxMinimum width of the app sidebar
--sidebar-max-width500pxMaximum width of the app sidebar
--list-min-width200pxMinimum width of a content list panel
--list-max-width300pxMaximum width of a content list panel
--body-container-margincalc(var(--default-grid-baseline) * 2)Margin around the main content container
--body-container-radiuscalc(var(--default-grid-baseline) * 3)Border radius of the main content container
--body-heightcalc(100% - ...)Computed height of the main content container
--breakpoint-mobile1024pxViewport width threshold for mobile layout

How Cn* components consume these

Every cn-* CSS class targets these variables — no hardcoded colors, no --cn-* custom tokens. Examples from the source:

/* CnDataTable header — selected row */
.cn-data-table tr.cn-table-row--selected {
background-color: var(--color-primary-light);
color: var(--color-primary-light-text);
}

/* CnStatusBadge — error variant */
.cn-status-badge--error {
background: var(--color-error);
color: var(--color-primary-text);
}

/* CnPageHeader spacing */
.cn-page-header {
padding: calc(var(--default-grid-baseline) * 4);
border-radius: var(--border-radius-element);
}

When the host app overrides a Nextcloud variable (for example NL Design System apps remap --color-primary-element to a government-blue token), every Cn* component picks the new value up automatically.

See also