# Theming

> Change the chart's colours and font with CSS variables.

The chart is styled with plain CSS and reads eight variables. Set any of them on `:root`, or on an element around the chart, and leave the rest.

```css
:root {
  --rt-font: 'Inter', sans-serif;
  --rt-ink: #1d2433;
  --rt-retention: #e4e7ec;
}
```

## Variables

| Variable | Default | Used for |
| --- | --- | --- |
| `--rt-font` | `inherit` | All text in the chart. By default it takes your page's font. |
| `--rt-ink` | <span class="tw-chip" style="background:#162033"></span>`#162033` | Text, axis lines, the outline of a selected layer. |
| `--rt-ink-soft` | <span class="tw-chip" style="background:#56627a"></span>`#56627a` | Axis labels and the key. |
| `--rt-surface` | <span class="tw-chip" style="background:#ffffff"></span>`#ffffff` | The gap under the dashed edge of an unlimited layer. Match your page background. |
| `--rt-rule` | <span class="tw-chip" style="background:#e8ebf0"></span>`#e8ebf0` | Grid lines behind the tower and the rule above the key. |
| `--rt-quote-outline` | `var(--rt-ink)` | Dashed outline for reinsurer-viewpoint quotes and indications. |
| `--rt-retention` | <span class="tw-chip" style="background:#d5d9df"></span>`#d5d9df` | The cedant's retention. |
| `--rt-loss` | <span class="tw-chip" style="background:#b3261e"></span>`#b3261e` | The loss wash and its flag. |

## An example

The same chart with a warmer palette and a serif font:

```css
.my-portal {
  --rt-font: Georgia, 'Times New Roman', serif;
  --rt-ink: #3b2f1e;
  --rt-ink-soft: #7a6a52;
  --rt-rule: #ece5d6;
  --rt-retention: #e2dccb;
  --rt-loss: #a1440b;
}
```

## Layer colours

Layer fills are not CSS variables, because they depend on the data. Layers of one contract share a colour, and colours are handed out in the order contracts first appear, from a set of ten pale fills chosen to keep dark text readable.

To fix a layer's colour, send `display.colorOverride` with that layer in your request:

```json
{
  "layerName": "First excess",
  "layerType": "XOL",
  "display": { "colorOverride": "#ffe0b2" }
}
```

With [`<TowerChart />`](https://towers.vinsa.dev/docs/react/tower-chart.md) you can go further and pass your own `fills` map.

## Dark pages

Layer labels are drawn in `--rt-ink` on pale fills, so the chart reads best on a light surface. On a dark page, put the chart in a light card rather than inverting the ink colour. That is what this site does.

## Sizing

The chart fills the width of its container. Set its height with the `height` prop. Towers of one risk sit side by side and wrap when there is less than about 280 pixels each.
