---
name: kimaai_chatbot_theme_vars
type: filter
since: 1.4.9
tier: free
feature: chatbot-appearance
area: chatbot
summary: Changes the chatbot's colours by code, per colour mode, as CSS custom properties.
parameters:
  - name: vars
    type: array
    description: The CSS custom properties, name => value, as the Appearance settings derive them.
  - name: theme
    type: array
    description: The theme of version 2, normalised; kept for filters written before the theme model.
  - name: appearance
    type: array
    description: The raw appearance settings.
  - name: look
    type: array
    description: The theme model (brand, style, mode, font, the colours of single parts and more) as the site's plan allows it; colours of single parts are Pro.
  - name: scheme
    type: string
    description: The colour mode these properties are for, light or dark.
returns:
  type: array
  description: The custom properties to print.
---

# kimaai_chatbot_theme_vars

## When it fires

When the widget's style is enqueued on a page with a chat, once per colour mode: once with `light` or `dark` when the Appearance settings fix the mode, twice (`light`, then `dark`) when they follow the site. KimaAI prints the result as an inline style on every chat root: the floating chat, inline chats, the Ask AI dialog and the search answer. The dark properties of Match the site apply on a root the widget marks as sitting on a dark page.

The widget reads the `--kimaai-w-*` properties, among them `--kimaai-w-brand`, `--kimaai-w-accent`, `--kimaai-w-bg`, `--kimaai-w-text`, `--kimaai-w-border`, `--kimaai-w-header-bg`, `--kimaai-w-header-text`, `--kimaai-w-answer-bg`, `--kimaai-w-answer-text`, `--kimaai-w-visitor-bg`, `--kimaai-w-visitor-text`, `--kimaai-w-input-bg` and `--kimaai-w-footer-bg`. Change values or add properties; a value that is not a string, or is empty, is left out. The properties inherit into the widget's shadow root, so they style the widget although the site's own CSS cannot reach it.

## Example

```php
add_filter(
  'kimaai_chatbot_theme_vars',
  function (array $vars, array $theme, array $appearance, array $look, string $scheme): array {
    // The header in the site's navy, a lighter one on dark pages.
    $vars['--kimaai-w-header-bg'] = $scheme === 'dark' ? '#1e3a5f' : '#14213d';
    $vars['--kimaai-w-header-text'] = '#ffffff';

    return $vars;
  },
  10,
  5
);
```

## Related

- `kimaai_chatbot_theme`: the six colours of the theme before this one, deprecated for this filter.
- `kimaai_chatbot_should_load`: whether the floating chat loads at all.
