Skip to main content

Styles

If you'd like to customize the style of a shape, the following reserved keywords can be set under the style field.

Below is a catalog of all valid styles, applied individually to this baseline diagram.

xy hi
note

The following SVGs are rendered with direction: right, but omitted from the shown scripts for brevity.

tip

Want to change the default styles for shapes and/or connections? See globs to change defaults.

Style keywords​

Opacity​

Float between 0 and 1.

y hi

Stroke​

CSS color name, hex code, or a subset of CSS gradient strings.

xy hi

For sql_tables and classes, stroke is applied as fill to the body (since fill is already used to control header's fill).

costumesidintPKsillinessintlast_updatedtimestampparser-lookahead[]rune+peek()(r rune, eof bool)+rewind()void+commit()void

Fill​

CSS color name, hex code, or a subset of CSS gradient strings.

xyz hi

For sql_tables and classes, fill is applied to the header.

costumesidintPKsillinessintlast_updatedtimestampparser-lookahead[]rune+peek()(r rune, eof bool)+rewind()void+commit()void

Want transparent?

xy

Fill Pattern​

Available patterns:

  • dots
  • lines
  • grain
  • none (for cancelling out ones set by certain themes)
xy hi

Stroke Width​

Integer between 1 and 15.

xy hi

Stroke Dash​

Integer between 0 and 10.

xy hi

Border Radius​

Integer between 0 and 20.

xy hi
info

border-radius works on connections too, which controls how rounded the corners are. This only applies to layout engines that use corners (e.g. ELK), and of course, only has effect on connections whose routes have corners.

Specifying a very high value creates a "pill" effect.

tylenol

Shadow​

true or false.

xy hi

3D​

true or false.

xy hi

Multiple​

true or false.

xy hi

Double Border​

true or false.

xy hi

Font​

Currently the only option is to specify mono. More coming soon.

xy hi

Font Size​

Integer between 8 and 100.

xy hi

Font Color​

CSS color name, hex code, or a subset of CSS gradient strings.

xy hi

For sql_tables and classes, font-color is applied to the header text only (theme controls other colors in the body).

costumesidintPKsillinessintlast_updatedtimestampparser-lookahead[]rune+peek()(r rune, eof bool)+rewind()void+commit()void

Animated​

true or false.

xy hi

Bold, italic, underline​

true or false.

xy hi

Text transform​

text-transform changes the casing of labels.

  • uppercase
  • lowercase
  • title
  • none (used for negating caps lock that special themes may apply)
tomJERRY Hi

Root​

Some styles are applicable at the root level. For example, to set a diagram background color, use style.fill.

Currently the set of supported keywords are:

  • fill: diagram background color
  • fill-pattern: background fill pattern
  • stroke: frame around the diagram
  • stroke-width
  • stroke-dash
  • double-border: two frames, which is a popular framing method
xy hi
info

All diagrams in this documentation are rendered with pad=0. If you're using stroke to create a frame for your diagram, you'll likely want to add some padding.