Script&Theory

§27 / DEVELOPERS

REF: TG–DOC–27 · REV. 1.7

CSS tokens

Tangent's global CSS custom properties are written by snippets/css-variables.liquid, which is rendered in the <head> of layout/theme.liquid before assets/base.css. Their values come from the theme settings. base.css and the section and snippet stylesheets read them with var().

TANGENT 1.7 / SHOPIFY OS 2.0 / UPDATED 2026-10-19

The defaults listed below are the schema defaults in config/settings_schema.json. Each preset sets its own values in config/settings_data.json.

Color tokens

Each color scheme in Theme settings > Colors becomes a class, .color-<scheme id>. The first scheme is also applied to :root. Sections apply a scheme with that class.

TokenScheme setting
--color-backgroundBackground
--color-background-rgbBackground, as space-separated R G B channels
--gradient-backgroundBackground gradient, or Background when no gradient is set
--color-foregroundText
--color-foreground-rgbText, as space-separated R G B channels
--color-mutedSecondary text
--color-surfacePanel background
--color-borderBorders
--color-buttonPrimary button background
--color-button-labelPrimary button label
--color-secondary-labelSecondary button label
--color-accentBadge background
--color-on-accentBadge text

Each scheme also sets color-scheme: dark when its background lightness is below 45, and light otherwise.

The -rgb tokens work with the space-separated rgb() syntax:

example.css
1.my-overlay {
2 background: rgb(var(--color-foreground-rgb) / 0.08);
3}
css

Dark mode

Dark mode uses the Dark mode setting (dark_mode: off, auto, toggle) and the Dark scheme setting (dark_scheme). When dark mode is not off, the dark scheme's values are applied to :root and to every light scheme (background lightness 80 or above) in two cases:

  • :root[data-theme='dark'] is set.
  • The device prefers dark (@media (prefers-color-scheme: dark)) and :root does not have data-theme='light'.

Dark mode also sets --media-bg to the dark scheme's panel background and color-scheme: dark. Darker or colored schemes keep their own colors.

With toggle, a [data-theme-toggle] button in the header sets data-theme on <html> and stores the choice in localStorage under tangent:theme. An inline script in layout/theme.liquid restores it before the page renders.

Typography tokens

TokenSourceSchema default
--font-headingHeading font family and fallbacks (type_heading_font)Archivo Narrow
--font-heading-weightHeading font weight700
--font-heading-styleHeading font stylenormal
--font-bodyBody font family and fallbacks (type_body_font)Archivo Narrow
--font-body-weightBody font weight400
--font-body-weight-mediumBody font weight + 100from the font
--font-body-weight-boldBolder body weightfrom the font
--font-body-styleBody font stylenormal
--heading-scaleheading_scale / 100 (range 70–140 %)1
--heading-caseheading_case (none, uppercase)uppercase
--heading-trackingheading_tracking / 100, in em (range −5 to 10 %)0em
--heading-line-heightheading_line_height / 100 (range 80–130 %)1
--body-sizebody_scale, in px (range 13–18)15px
--label-caselabel_case (none, uppercase)uppercase
--button-casebutton_case (none, uppercase)uppercase

Layout tokens

TokenSourceSchema default
--page-widthpage_width (1200px, 1440px, 1600px, or full = 100vw)1600px
--gutterclamp(16px, 3vw, <page_margin>px); page_margin range 8–64clamp(16px, 3vw, 48px)
--section-spacesection_spacing / 100 (range 50–150 %)1
--grid-gapgrid_gap, in px (range 0–32)12px
--card-info-gapcard_info_spacing, in px (range 8–32)16px
--header-height60px in CSS; replaced at runtime (see below)60px

--section-space scales section padding in base.css: calc(96px var(--section-space)) on desktop and calc(64px var(--section-space)) below 750 px.

Shape and media tokens

TokenSourceSchema default
--radius-buttonbutton_radius, in px (range 0–40)2px
--radius-inputinput_radius, in px (range 0–20)2px
--swatch-radiusswatch_shape: square = 2px, circle = 50%50%
--media-bgmedia_background (Product image background)#F2F2F2
--card-ratiocard_ratio (adapt = auto, 1, 0.8, 0.667)0.8
--card-fitcard_image_fit (cover, contain)cover

--card-ratio and --card-fit are emitted but not read by any stylesheet on this branch. Product cards set their own --ratio and the media--contain class in snippets/product-card.liquid.

Motion tokens

example.css
1:root {
2 --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
3 --duration: 0.34s;
4}
css

These are the only global motion tokens. base.css uses var(--ease) and var(--duration) for transitions, for example the scroll reveal (opacity and transform over 0.8 s with var(--ease)).

The Motion settings control which effects are on:

SettingEffect
Reveal sections on scroll (animations_reveal)Adds reveal-on to <body>
Slow zoom on banners (animations_zoom)Adds zoom-on to <body>; hero images use the hero-drift animation
Smooth page transitions (page_transitions)Enables cross-document view transitions in layout/theme.liquid

Reduced motion

Motion effects in base.css sit inside @media (prefers-reduced-motion: no-preference). For shoppers who prefer reduced motion, base.css shortens all animations and transitions:

example.css
1/* assets/base.css */
2@media (prefers-reduced-motion: reduce) {
3 *:not(.marquee__track),
4 *::before,
5 *::after {
6 animation-duration: 0.01ms !important;
7 animation-iteration-count: 1 !important;
8 transition-duration: 0.01ms !important;
9 scroll-behavior: auto !important;
10 }
11}
css

The JavaScript checks the same preference through window.Tangent.prefersReducedMotion(): smooth scrolling becomes instant, view transitions are skipped, slider autoplay does not start, and <video-media> does not autoplay.

Tokens set at runtime

TokenSet byValue
--header-height<site-header> (theme.js) on :rootHeight of .header in px, updated on resize
--above-header<site-header> on :rootOffset of the header section from the top (the announcement bar)
--announcement-heightsections/announcement-bar.liquid on :root36px; used before --above-header is set
--sticky-buy-height<sticky-buy> (product.js) on :rootHeight of the sticky add-to-cart bar

Component-level properties such as --overlay (hero, slideshow, collage), --pos (<compare-slider>) and --from / --to (<price-range>) are set inline on their elements.

Overriding tokens

Override a token on :root or on a scheme class in your own stylesheet, loaded after base.css:

example.css
1:root {
2 --ease: cubic-bezier(0.4, 0, 0.2, 1);
3}
4.color-scheme-2 {
5 --color-border: #d6d6d6;
6}
css

Values set in theme settings are regenerated on every page load, so change them in the theme editor where a setting exists.

Get support ↗