
<CartWidgetPage group="theming" />

<Method id="css-variables" signature="#subbly-cart-widget { --accent }">

The custom properties the widget computes from the cart settings and writes
on its container. A property whose setting is empty is not written, and the
widget falls back to the [base token](#base-tokens). To override them from
your own CSS, see
[Style the widget](/developer-resources/cart-widget/style-it).

<Params title="Properties">
  <Param name="--accent" type="color">
    From `accentColor`, else the shop's brand colour. Default `var(--black)`.
  </Param>
  <Param name="--accent-alpha-01" type="color">
    The accent at 10% opacity. Default `var(--black-alpha-01)`.
  </Param>
  <Param name="--accent-alpha-08" type="color">
    The accent at 80% opacity. Default `var(--black-alpha-08)`.
  </Param>
  <Param name="--accent-font" type="color">
    Text on the accent. The widget picks dark text on a light accent, white on
    a dark one. Default `var(--white)`.
  </Param>
  <Param name="--backdrop-bg" type="color">
    From `backgroundColor`. The screen behind the widget. Default
    `var(--black-alpha-06)`.
  </Param>
  <Param name="--widget-bg" type="color">
    From `widgetBackgroundColor`, and a gradient down to
    `widgetBackgroundDarker` when that is set. Default `#EAEFF3`.
  </Param>
  <Param name="--font-primary" type="font stack">
    From `fontStyle`, in front of the system stack. Default the system stack.
  </Param>
  <Param name="--font-color-primary" type="color">
    From `fontColorPrimary`. Default `var(--black)`.
  </Param>
  <Param name="--font-color-secondary" type="color">
    From `fontColorSecondary`. Default `var(--gray-600)`.
  </Param>
  <Param name="--font-color-secondary-alpha-08" type="color">
    The secondary colour at 80% opacity. Default `#464646aa`.
  </Param>
  <Param name="--font-color-secondary-alpha-01" type="color">
    The secondary colour at 10% opacity. Default `#4646461a`.
  </Param>
  <Param name="--button-border-radius" type="length">
    From `buttonStyle`, in pixels. Default `8px`.
  </Param>
  <Param name="--card-bg" type="color">
    From `cardBackgroundColor`. Default `var(--white)`.
  </Param>
  <Param name="--card-border-color" type="color">
    From `cardBorderColor`. Default `#D3D9DE`.
  </Param>
  <Param name="--card-border-radius" type="length">
    From `cardStyle`, in pixels. Default `8px`.
  </Param>
  <Param name="--card-divider-color" type="color">
    From `cardDividerColor`. Default `#D6D1C2`.
  </Param>
  <Param name="--card-padding" type="length">
    No setting drives it. Default `14px`.
  </Param>
  <Param name="--control-hover-bg" type="color">
    Computed from `cardBackgroundColor`: a shade darker on a light card,
    brighter on a dark one. Default `var(--gray-125)`.
  </Param>
  <Param name="--header-height" type="length">
    From `headerHeight`, in pixels. Default `52px`.
  </Param>
  <Param name="--header-bg" type="color">
    From `headerBackgroundColor`, else `widgetBackgroundColor`. Default
    `var(--widget-bg)`.
  </Param>
  <Param name="--header-font-color" type="color">
    From `headerFontColor`. Default `var(--font-color-primary)`.
  </Param>
  <Param name="--footer-bg" type="color">
    From `footerBackground`, else `widgetBackgroundDarker`. Default
    `var(--widget-bg)`.
  </Param>
  <Param name="--footer-font-color" type="color">
    From `footerFontColor`, else `fontColorPrimary`. Default
    `var(--font-color-primary)`.
  </Param>
  <Param name="--input-bg" type="color">
    From `inputBackground`. Default `var(--white)`.
  </Param>
  <Param name="--input-border-color" type="color">
    From `inputBorderColor`. Default `var(--gray-300)`.
  </Param>
  <Param name="--input-font-color" type="color">
    From `inputFontColor`. Default `var(--black)`.
  </Param>
  <Param name="--segment-control-bg" type="color">
    From `segmentControlBackground`. Default `var(--accent)`.
  </Param>
  <Param name="--segment-control-font-color" type="color">
    Text on the segmented control, computed from its background. Default
    `var(--accent-font)`.
  </Param>
  <Param name="--cart-button-icon-color" type="color">
    Icon on the floating cart button, computed from the accent. Default
    `#F9FDFF`.
  </Param>
  <Param name="--cart-button-bg, --cart-button-text-color" type="color">
    Written from `accentColor` and its computed text colour, but no stylesheet
    reads them. The floating cart button paints its background with
    `var(--accent)`. Override the accent to change it.
  </Param>
</Params>

<Example>

```css title="Override the accent"
#subbly-cart-widget {
  --accent: #701eff !important;
  --button-border-radius: 24px !important;
}
```

</Example>

</Method>

<Method id="base-tokens" signature=".SubblyAppContainer { --gray-100 }">

The palette the widget's own styles are built on. No setting changes these.
They are declared on the container class `.SubblyAppContainer`, so a rule on
`#subbly-cart-widget` overrides them without `!important`.

<Params title="Tokens">
  <Param name="--black, --white" type="color">
    `#000` and `#fff`.
  </Param>
  <Param name="--black-alpha-01 … --black-alpha-08" type="color">
    Black at five alpha steps: `#0001`, `#0002`, `#0004`, `#0006` and `#0008`,
    which is about 7%, 13%, 27%, 40% and 53% opacity.
  </Param>
  <Param name="--gray-100 … --gray-800" type="color">
    The grey ramp: `100`, `125`, `150`, `175`, `200`, `250`, `300`, `350`,
    `375`, `400`, `450`, `500`, `600` and `800`, from `#F7F7F7` down to
    `#1B1B1B`.
  </Param>
  <Param name="--blue-700" type="color">
    `#1624A4`.
  </Param>
  <Param name="--red-100, --red-200, --red-700" type="color">
    The error colours: `#FCF0ED`, `#E49D92` and `#C92E2E`.
  </Param>
  <Param name="--orange-500" type="color">
    `#D35307`, for warnings.
  </Param>
  <Param name="--green-200, --green-400, --green-700" type="color">
    The success colours: `#E8F2ED`, `#82CEA2` and `#16A480`.
  </Param>
  <Param name="--success" type="color">
    `var(--green-700)`.
  </Param>
  <Param name="--focus-outline" type="color">
    `var(--blue-700)`. The ring around a focused control.
  </Param>
</Params>

<Example>

```css title="Match the widget to your own palette"
#subbly-cart-widget {
  --gray-100: #f5f3ef;
  --focus-outline: #701eff;
}
```

</Example>

</Method>
