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.

Parameters

NameTypeDescription
varsarrayThe CSS custom properties, name => value, as the Appearance settings derive them.
themearrayThe theme of version 2, normalised; kept for filters written before the theme model.
appearancearrayThe raw appearance settings.
lookarrayThe 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.
schemestringThe colour mode these properties are for, light or dark.

Returns

array: The custom properties to print.

Example

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
);
  • 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.

What are your feelings