# Match your brand

Source: https://help.ruuster.com/idx/theming

> The recipe components take their colors and fonts from your Ruuster brand kit through --rw- CSS variables, and you can change any of them in your own CSS.

The recipe components draw every color and font from CSS variables whose names start with `--rw-`.
Your Ruuster brand kit (the colors and fonts you set for your Ruuster listing search) comes back from
`GET /v1/meta` as `themeVars`, a set of those variables. Pass it to `RecipesStyles` and every card,
map pin, form and listing page matches your brand on the first render. Without it the recipes use
the default look shown in the screenshots below.

## Step 1: print the stylesheet with your brand kit

Add `RecipesStyles` once, in your root layout, with `themeVars` from `/v1/meta`. The meta answer
changes rarely, so cache it for an hour.

<p class="code-title"><code>packages/ruuster-idx-recipes/snippets/layout.tsx</code></p>

```tsx
// themeVars is your Ruuster brand kit as --rw-* CSS variables. Without it the recipes use the default look.
const meta = await idx.meta();
const themeVars = meta.ok ? meta.data.themeVars : undefined;
```

The full layout file is on [Recipe components](https://help.ruuster.com/idx/recipe-components).
Over plain HTTP, read `themeVars` from `GET https://idx.ruuster.com/v1/meta` and print each pair
inside a `.rw-recipes { }` rule in your own stylesheet.

## Step 2: change anything in your own CSS

Your brand kit's variables are printed with `:where(.rw-recipes)`, which has no specificity. A
`.rw-recipes { }` rule in your own CSS always wins, wherever it loads. To change one component's
layout, start your selector with `body` or a class of your own so it outranks the recipe rule.

<p class="code-title"><code>packages/ruuster-idx-recipes/snippets/theme-override.css</code></p>

```css
/* app/globals.css: your own values win over the brand kit, because :where(.rw-recipes) has no specificity. */
.rw-recipes {
  --rw-colors-accent: #1d4ed8;
  --rw-colors-text-on-gold: #ffffff;
  --rw-colors-surface-card: #0f172a;
  --rw-colors-text-on-chrome: #ffffff;
  --rw-colors-interactive-primary: #0f172a;
  --rw-colors-interactive-primary-hover: #1e293b;
  --rw-fonts-sans: "Source Sans 3", Arial, sans-serif;
  --rw-fonts-serif: "Lora", Georgia, serif;
}

/* A component's own rule: start with body (or a class of your own) so it outranks the recipe rule. */
body .rw-recipes.rw-card {
  border-radius: 8px;
}
```

## Match your site's own colors, dark sites included

When your site already has its own color variables, point the recipes' variables at them and every
widget (cards, the listing page, the search box and its menu, the calculator, the tour and contact
screens) looks like part of your page. This is how the Ruuster website templates do it, light and
dark. Replace `--page`, `--text` and the rest with your own variable names:

```css
/* On each widget root and its screens, so a widget in a dark band picks up that band's colors. */
.rw-recipes, dialog.rw-recipes {
  --rw-colors-primary: var(--text);            /* body text */
  --rw-colors-text-primary: var(--text);
  --rw-colors-secondary: var(--text-muted);    /* labels, addresses */
  --rw-colors-white: var(--card);              /* panels and fields */
  --rw-colors-surface-base: var(--card);
  --rw-colors-grey: var(--border);             /* field and section borders */
  --rw-colors-stroke-light: var(--border);
  --rw-colors-grey3: var(--subtle);            /* quiet backgrounds */
  --rw-colors-surface-grey: var(--subtle);
  --rw-colors-cream-background: var(--subtle);
  --rw-colors-cream-border: var(--border);
  --rw-colors-interactive-primary: var(--button);
  --rw-colors-text-on-primary: var(--button-text);
  --rw-colors-accent: var(--button);
  --rw-colors-text-on-gold: var(--button-text);
  --rw-colors-surface-chrome: var(--button);   /* the header bar of the tour and contact screens */
  --rw-colors-text-on-chrome: var(--button-text);
  --rw-colors-focus-ring: var(--button);
  --rw-fonts-sans: var(--body-font);
  --rw-fonts-serif: var(--heading-font);
}
/* The listing page and calculator sit straight on your page; only their cards are panels. */
.rw-recipes.rw-detail, .rw-recipes.rw-mortgage, .rw-recipes .rw-detail-header { background: transparent; }
```

Declare the variables on the widget root, as above, rather than once on `body`: a variable resolves
where it is declared, so a widget inside a dark section then takes that section's colors. Check the
pairs in [Contrast](#contrast) after you map them.

## The variables the recipes read

These are the variables the recipes' stylesheet uses, with the default each one falls back to. The
"Set by" column names the brand kit field that moves it.

| Variable | Default | Set by | Where it shows |
|---|---|---|---|
| `--rw-fonts-sans` | `Inter, Arial, sans-serif` | Body font | All text |
| `--rw-fonts-serif` | `Marcellus, Georgia, serif` | Heading font | Section titles on the listing page |
| `--rw-colors-primary` | `#242424` | Primary color | Body text, map pin prices, the current page link border |
| `--rw-colors-secondary` | `#6b6b6b` | Primary color (a lighter shade) | Addresses on the listing page, labels, notices |
| `--rw-colors-accent` | `#fbe08e` | Secondary color | The photo count button, the area outline on the map, the pending status dot |
| `--rw-colors-accent-light` | `#FDEFC5` | Secondary color (a lighter shade) | The highlighted row in the search box |
| `--rw-colors-text-on-gold` | `#242424` | Secondary color (black or white for contrast) | Text on accent buttons |
| `--rw-colors-interactive-primary` | `#242424` | Button color | Buttons, the current page, checked boxes |
| `--rw-colors-interactive-primary-hover` | `#3a3a3a` | Button color | Buttons on hover |
| `--rw-colors-text-on-primary` | `#fff` | Button color (black or white for contrast) | Button text |
| `--rw-colors-focus-ring` | `#242424` | Button color | The keyboard focus outline and focused fields |
| `--rw-colors-surface-card` | `#222d30` | Sidebar color | The listing card's band under the photo |
| `--rw-colors-text-on-chrome` | `#fff` | Sidebar text color | Price, facts and address on the card |
| `--rw-colors-stroke-card-line` | `#4e5659` | Sidebar color | The dividers between beds, baths and square feet on the card |
| `--rw-colors-icon-on-card` | `#7A8183` | Sidebar color | Card icons and the photo dots |
| `--rw-colors-grey` | `#E3E3E3` | Border color | Field borders, listing page sections, map tiles |
| `--rw-colors-stroke-light` | `#E3E3E3` | Border color | Notice boxes |
| `--rw-colors-grey3` | `#F2F2F2` | Fixed | Group headings in the search box, the empty results box |
| `--rw-colors-surface-grey` | `#F2F2F2` | Fixed | The map frame while the map loads |
| `--rw-colors-cream-background` | `#F9F6EB` | Fixed | The lead form background |
| `--rw-colors-overlays-card` | `#151C1E33` | Fixed | The badge and arrows on card photos |
| `--rw-colors-overlays-card-hover` | `#151C1E4D` | Fixed | The card photo arrows on hover |
| `--rw-colors-link-default` | `#242424` | Primary color | The virtual tour link |
| `--rw-colors-hovers-primary` | `#3a3a3a` | Fixed | The listing page's Back link and dark buttons on hover |
| `--rw-colors-hovers-accent` | `#f0cc6a` | Fixed | Accent buttons on the listing page on hover, such as "Choose tour time" |
| `--rw-colors-interactive-accent-hover` | `#f0cc6a` | Fixed | Accent buttons in the share, contact and tour screens on hover |
| `--rw-colors-surface-chrome` | the value of `--rw-colors-surface-card` | Fixed | The header bar of the share, contact and tour screens and of the filters drawer |
| `--rw-colors-text-on-cream` | `#8E762C` | Fixed | Text on cream backgrounds in the share, contact and tour screens |
| `--rw-colors-text-tertiary` | `#6f6f6f` | Fixed | The mortgage disclosures and turned-off buttons |
| `--rw-colors-white` | `#fff` | Fixed | White text and icons over photos and dark buttons on the listing page |
| `--rw-colors-green2` | `#208D28` | Fixed | The status dot of an active listing in the price block, and the WhatsApp button |
| `--rw-colors-green` | `#00D36F` | Fixed | The "Happening now" dot of an open house |
| `--rw-colors-danger` | `#FF5858` | Fixed | The status dot of a sold listing in the price block |
| `--rw-colors-status-danger` | `#FF5858` | Fixed | Error lines in the share, contact and tour screens |
| `--rw-colors-blue` | `#0067F8` | Fixed | The Facebook button in the share screen |
| `--rw-colors-grey2` | `#A0A0A0` | Fixed | The bullets of the property details lists |
| `--rw-colors-chart-1` to `--rw-colors-chart-5` | `#2b5797`, `#a16207`, `#2f7d4f`, `#b42318`, `#6941c6` | Fixed | The mortgage calculator's ring chart and legend: principal and interest, property taxes, home insurance, mortgage insurance and HOA dues |

The brand kit sends the full set of 69 variables. The ones the recipes read are above; the rest are
there for your own components, so a button you build can use `var(--rw-colors-interactive-primary)`
and match.

<figure class="idx-shot"><img src="/idx-docs/screens/ours/listing-card-1440.png" alt="Listing card with photos and the attribution its board requires on cards, on a desktop (1440 px wide)" width="1440" height="900" loading="lazy" decoding="async"><figcaption>A card in the docs brand: a near-black band from the sidebar color and the yellow accent.</figcaption></figure>

<figure class="idx-shot"><img src="/idx-docs/screens/ours/listing-card-375.png" alt="Listing card with photos and the attribution its board requires on cards, on a phone (375 px wide)" width="375" height="812" loading="lazy" decoding="async"><figcaption>A card in the docs brand: a near-black band from the sidebar color and the yellow accent.</figcaption></figure>

The markup is `static/html/listing-card.html` in `@ruuster/idx-recipes`. The [HTML and CSS recipe](https://help.ruuster.com/idx/recipe-html-css) shows how to fill it and which stylesheet and script to load.

## Fonts

The recipes name your fonts; your site loads them. If your brand kit uses Inter and Marcellus, load
them once in your layout (with `next/font` in Next.js, or a Google Fonts link), and the recipes pick
them up through `--rw-fonts-sans` and `--rw-fonts-serif`.

## Contrast

The default colors for text on solid backgrounds meet WCAG 2.2 AA contrast. When you change a background variable, change
its text partner too: `--rw-colors-surface-card` with `--rw-colors-text-on-chrome`,
`--rw-colors-interactive-primary` with `--rw-colors-text-on-primary`, and `--rw-colors-accent` with
`--rw-colors-text-on-gold`. The five chart colors each have at least 3 to 1 contrast on white, so a
slice of the ring chart stands out; keep that contrast when you change them.

## Let your AI tool do it

[Prompt: match your brand](https://help.ruuster.com/idx/prompt-brand) asks your AI coding
assistant to read your `themeVars`, add `RecipesStyles` to your layout and check the contrast of any
color you change.

On a site without React, such as PHP, Python, Ruby on Rails, Go or plain HTML, [Build without React: HTML, CSS and JavaScript](https://help.ruuster.com/idx/recipe-html-css) gives you the same markup, the stylesheet and the script for every widget.
