The admin

Themes

Change the admin's look with a theme package or your own custom properties.

The admin's look comes from --mortar-* CSS custom properties: colours, fonts, radii and gaps. A theme only sets those values. It never changes the layout.

Using a theme package

Mortar ships four themes: @mortar-kit/theme-midnight, -warm, -soft and -mono. Pick one in vite.config with the mortarKit() plugin:

import { mortarKit } from '@mortar-kit/admin/vite';
import warm from '@mortar-kit/theme-warm';

export default defineConfig({
  plugins: [solid({ ... }), mortarKit({ theme: warm })],
});

The theme's stylesheet is served only with the admin's CSS, so it never lands on your public pages. This site's admin uses midnight.

Your own values

The defaults sit at zero specificity, so any rule wins over them. Override a few on an element around the admin:

.admin {
  --mortar-accent: #e11d48;
  --mortar-radius: 4px;
}

Making a theme package

A theme package is plain JavaScript with no build: a theme.css that sets --mortar-* on :root, and an index.js that exports its name and the stylesheet's path:

import { fileURLToPath } from 'node:url';

export const name = 'forest';
export const stylesheet = fileURLToPath(new URL('./theme.css', import.meta.url));
export default { name, stylesheet };

The full list of tokens, with the default values, is in packages/admin/src/tokens.css. Fonts that a theme names aren't loaded by Mortar, so load them in your app or let the fallbacks apply.

mortarKitfunction

import { mortarKit } from '@mortar-kit/admin/vite'

function mortarKit(options?: MortarKitOptions): Plugin

Mortar's Vite plugin. Add it next to @solidjs/vite-plugin:

import { mortarKit } from '@mortar-kit/admin/vite';
import midnight from '@mortar-kit/theme-midnight';

export default defineConfig({ plugins: [solid({ ... }), mortarKit({ theme: midnight })] });

Parameters

Returns

Plugin