Skip to main content

Colours and fonts

Diagrams look like part of your site. By default they take its colours and fonts from the Infima variables the classic theme uses, in light and dark mode:

  • table headers from your primary colour (--ifm-color-primary and its -dark, -darker, -darkest shades), always with readable header text;
  • highlights (the selected table, highlighted refs, the focus ring) from your primary colour, adjusted until they stand out from the canvas;
  • surfaces and text from --ifm-background-surface-color and --ifm-font-color-base: table cards on your surface colour, muted tones mixed from your text colour;
  • sticky notes and error banners from your warning and danger colours;
  • fonts: names in --ifm-font-family-base, column types in --ifm-font-family-monospace.

Colours written in the DBML always win: a table's headercolor and the colours of table groups, notes and refs. On a dark canvas, a group colour that would be too dark to read (a navy group on a dark page) is lightened just enough, keeping its hue.

Exports match the page: SVG and PNG files exported from a diagram use the colours and fonts it shows, including your overrides. Printing always uses light colours.

relvista's own palette​

To draw diagrams in relvista's blue-grey palette instead, as the editor does, set palette in themeConfig.dbml:

docusaurus.config.ts
themeConfig: {
dbml: {
palette: 'relvista', // default: 'site'
},
},

One diagram can choose for itself with the component: <DbmlDiagram palette="relvista" … />.

Overriding colours in custom.css​

Every colour a diagram draws is a CSS variable named --rv-*. Set any of them in your site's custom.css; your rules win over both palettes, whatever their specificity or load order:

src/css/custom.css
/* All diagrams, both modes */
.rv-viewer {
--rv-header-bg: #334155;
--rv-font: 'IBM Plex Sans', sans-serif;
}

/* Dark mode only */
[data-theme='dark'] .rv-viewer {
--rv-canvas-bg: #0b0d12;
}

/* One diagram: give it a class with <DbmlDiagram className="billing" … /> */
.billing .rv-viewer {
--rv-header-bg: #7c2d12;
}

The site palette is the class rv-palette-site on .rv-viewer, so .rv-viewer.rv-palette-site targets only diagrams that follow the site.

Diagram​

VariableWhat it colours
--rv-canvas-bgCanvas background
--rv-grid-dotDots of the canvas grid
--rv-table-bgTable card background
--rv-table-borderTable card border
--rv-table-shadowTable and note shadow
--rv-header-bgTable header band (unless the table has a headercolor)
--rv-header-textTable name in the header band
--rv-row-textColumn names
--rv-type-textColumn types
--rv-row-dividerLines between columns
--rv-row-highlightBackground of highlighted columns (the ends of a hovered ref)
--rv-pk-markerPrimary key icon
--rv-fk-markerForeign key arrow
--rv-badge-bgBackground of column badges (unique, not null, ...)
--rv-badge-textText of column badges
--rv-note-indicatorDot marking columns that have a note
--rv-ref-strokeRef lines and their cardinality markers
--rv-ref-highlightRef lines of the hovered or selected table
--rv-group-defaultTable groups without a colour
--rv-note-bgSticky note background (unless the note has a colour)
--rv-note-borderSticky note border
--rv-note-textSticky note text
--rv-selectionRing around a selected or highlighted table

Toolbar, title, cards and messages​

VariableWhat it colours
--rv-ui-bgToolbar and title chip (slightly translucent)
--rv-ui-solidMinimap, menus and the table details card
--rv-ui-borderDiagram frame and the borders of toolbar, menus and card
--rv-ui-textText and icons of toolbar, menus and card
--rv-ui-mutedSecondary text (types and notes in the details card)
--rv-ui-hoverHovered buttons and menu items
--rv-ui-activePressed buttons
--rv-ui-shadowShadow of toolbar, menus and card (a box-shadow value)
--rv-ui-focusKeyboard focus ring
--rv-error-bgDBML error banner background
--rv-error-borderDBML error banner border
--rv-error-textDBML error banner text

Fonts​

VariableWhat it sets
--rv-fontTable, column, group and note names, toolbar and card text
--rv-monoColumn types, and code in the details card and error banner

Tables are sized for relvista's own font metrics; a much wider font can make long names reach the edge of their table.