---
title: "Themes and render plugins"
description: "Style the widget with CSS tokens and shadow parts, and extend how Markdown appears."
---

> Documentation Index
> Fetch the complete documentation index at: https://blua.pwp.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Themes and render plugins

## Adjust the appearance

In **Components**, preview the theme, button color and corner radius before copying the embed code. `theme` accepts `auto`, `light` and `dark`. Add these overrides to the host page for a direct embed.

```css
blua-comments {
  --blua-color-primary: #963653;
  --blua-color-primary-ink: white;
  --blua-radius-card: 10px;
}
blua-comments::part(content) {
  line-height: 1.7;
}
blua-comments::part(submit) {
  border-radius: 999px;
}
```

Use the `themeTokens` object for a single JS instance. An iframe reads tokens from its URL, such as `&--blua-radius-card=10px`. Use `createBluaFrameUrl` to encode colors containing `#` or font names with spaces.

## Enable callouts

```js
import { mountBluaComments } from '@blua/embed/register';
import { calloutsPlugin } from '@blua/embed/plugins/callouts';

const thread = mountBluaComments(document.querySelector('#discussion'), {
  endpoint: 'https://blua.example',
  siteKey: 'garden',
  pageKey: 'spring-swallows',
  plugins: [calloutsPlugin],
});
```

Place `<div id="discussion"></div>` on the page first. Start a comment with `> [!TIP]` and begin the next line with `> ` followed by the tip. Framework adapters accept the same `plugins` array. For an iframe, add `plugins=callouts` to the URL. Call `thread.remove()` to unmount a JS instance.

## Write a plugin

```ts
import type { BluaRenderPlugin } from '@blua/embed';

export const codeLabels: BluaRenderPlugin = {
  name: 'code-labels',
  enhance(body) {
    for (const node of body.querySelectorAll('code')) node.part.add('inline-code');
  },
};
```

Include the plugin in `plugins`, then style `::part(inline-code)`. Plugins run in array order on the sanitized comment DOM. If a plugin throws, the comment returns to its original rendering and emits `blua:plugin-error`. Load modules trusted by the site operator.

To install a custom iframe plugin, serve `/embed/plugins/code-labels.js` from the gateway with a default export whose `name` is `code-labels`. Set `BLUA_FRAME_PLUGINS=code-labels` on the gateway, then request `plugins=code-labels` in the frame URL.

Source: https://blua.pwp.sh/docs/en/embed/themes/
