Diagram and Documentation Styles
DbSchema lets you change how the diagram looks: its theme, the color of each table, and its fonts and colors through CSS. Some of these changes reach the HTML5 documentation as well.
None of these changes touches the database.
Choose a theme
A theme sets the colors of the whole DbSchema window, the diagram included.
- Choose View → Appearance → Theme.
- Click a theme: Classic, Architect, Caspian, Moonlight or Dark.
- Press Apply & Close.
The theme belongs to your DbSchema installation, not to the model. A colleague who opens your model sees it in their own theme.
Color a table
A table color groups related tables at a glance, such as all the order tables in orange.
- Right-click the table header on the diagram.
- Choose Change Color.
- Press Color and pick the color.
- Tick In All Diagrams to use the color on every diagram that shows the table.
- Press OK.
DbSchema saves the color in the model file. The HTML5 documentation and the PDF use it for the table header, with the brightness of their own light or dark style.
Change fonts and colors with custom CSS
DbSchema draws its windows and the diagram with CSS, the same style language as web pages. Your own CSS rules load after the theme, so they override it, and they stay when you update DbSchema.
- Choose View → Appearance → Theme.
- Press Edit Custom CSS.
- Type your rules. The dialog starts with commented examples that you can copy.
- Press Save & Apply.
This rule sets bigger table names and a green table body:
/* Bigger table names and a green table body on the diagram */
.diagram, .diagram > .viewport {
font: 14px 'System';
table-header-font: bold 16px 'System';
table-background: #12291f;
table-header-foreground: #ffd479;
}
If the diagram keeps its old look after Save & Apply, click an empty spot on the diagram to redraw it.
DbSchema saves the rules in custom.css, in the config/appearance folder of your DbSchema settings folder, which is .DbSchema in your home folder.
To go back to the theme, delete the rules and press Save & Apply.
What reaches the HTML5 documentation
The HTML5 documentation and the PDF have their own light style, or a dark one with Dark Theme.
- The fonts of the diagram, set by
font,table-header-fontandcallout-font, carry into the documentation's diagram image. - The colors set in CSS stay in DbSchema. The documentation keeps its own colors.
- The table colors from Color a table carry into the documentation.
Find the property to change
Each theme is a set of CSS files in the config/appearance folder of the DbSchema installation.
Open them to copy a value. Do not edit them: an update replaces them.
The rules use three blocks:
.root: the windows, dialogs and menus. Values that start with-fx-are JavaFX's own, and values that start with-var-are DbSchema's..diagram, .diagram > .viewport: the diagram. Write both selectors, as the Moonlight theme does..code-editor: the SQL editor.
A value can be a color such as #12291f, or a variable such as -var-diagram.
Diagram properties
| Property | What it paints |
|---|---|
font, table-header-font, callout-font | The fonts of column names, table names and callouts |
table-background | The body of a table |
table-header-bottom-1, table-header-bottom-2 | The table header, as a gradient |
table-header-top-1, table-header-top-2 | The thin strip on top of the header, in themes that draw one |
table-header-foreground | The table name |
table-background-selected, table-header-foreground-selected | A selected table |
column-foreground | Column names |
column-primary-key, column-icon-pk-foreground | Primary key column names, and the key icon |
column-foreign-key, column-icon-fk-foreground, column-icon-plate-background | Foreign key column names, the arrow icon, and the plate behind it |
column-icon-unique-foreground, column-icon-index-foreground | The unique and index icons |
column-mandatory | The asterisk of mandatory columns |
column-data-type | The data type icon or text |
foreign-key, foreign-key-text, foreign-key-line-width | Foreign key lines, their labels and their width |
group-background, group-transparency-value, group-border-color, group-border-width | The area and the border of a group |
group-text, group-text-background | The name of a group |
callout-background, callout-foreground, callout-border-color | Callouts |
Where a table or a group has its own color, the header, the border and the group properties keep that color's hue. They take only the brightness and the saturation from the CSS value. table-background applies as it is, whatever the table color.
SQL editor properties
| Property | What it paints |
|---|---|
background | The editor ground |
caret-line-background | The line that holds the cursor |
selection-background | Selected text |
keyword-foreground, string-foreground, comment-foreground | SQL keywords, strings and comments |
Common problems
How do I change the look of tables?
Use a theme for the whole look, Change Color for single tables, and custom CSS for fonts and exact colors. Each is a section above.
My CSS has no effect
Check the selector: diagram properties belong in .diagram, .diagram > .viewport, not in .root.
Then click the diagram to redraw it.