Options Quick Reference
Quick reference for all available options.
Options can be set in the DSL string or programmatically via the constructor.
Spelling: every option on this page works in either casing, so [margin-top=3] and [marginTop=3] are one option, as are { marginTop: 3 } and { 'margin-top': 3 }. The names below are the spelling a string gives back, except where a shorthand exists: a part's x and y come back as the CODE:x,y suffix, and the two kerning options come back as RK: and AK:. toJSON() gives back the camelCase name in every case. For attributes you pass through rather than options the library names, see which name is emitted.
What counts as an option: anything toString() writes inside a [...] bracket, at any scope. A save without options and clearOptions() remove exactly that, so a part's x and y and the two kerning options, which come back outside the bracket, stay (see Positioning). So do the options a code brings by its definition: they are part of the code, even where a save spells a custom code out with its own options in a part bracket ([color=red]>B291).
A definition's own options (its defaultOptions, or a built-in's own look such as the dotted line of REFSQUARE) belong to the part the code is: a character, word or global option does not override them, and a part bracket where the code is used does.
Scope: the Rendering and Dots options (plus SVG pass-through attributes) cascade at every scope: global [opts]||, word [opts]|, character [opts], part [opts]>. The Backgrounds and Links options work at every scope too. Everything else on this page is canvas-wide and takes effect only at global scope; written at any other scope, in a bracket or from JavaScript, the key is dropped with a MISPLACED_GLOBAL_OPTION warning.
Where a pass-through attribute lands: at global scope it styles the symbol, on the group holding the artwork, and never reaches the grid or the paper. The attributes that describe the image (role, aria-*, id, class, data-*, lang, tabindex, preserveAspectRatio, overflow, and the root's own viewBox, width and height) go on the root <svg> instead, and href makes the whole picture a link. Prefix an attribute to target one part of the output instead: every class the library writes is a target, spelled without the bliss- prefix, and the attribute follows the last --, so root--, background--, background-zone--top--, grid--, grid-line--sky--, content-- and element-background-- are all keys you can write. At any other scope the attribute goes on the <g> wrapping that element, and a prefixed key there is dropped with a MISPLACED_LAYER_OPTION warning, however it was written, or with the refusal its name would get at global scope when it would get one there too. The one exception is element-background--, which is kept there and styles the backgrounds of that element and everything inside it. xmlns is refused behind a prefix, since it would move the subtree out of SVG. See SVG pass-through attributes.
Rendering
| Option | Default | Range | Description |
|---|---|---|---|
color | #000000 | Any color | Stroke color. This name is taken, so the raw color attribute is written content--color (see targeting one part) |
stroke-width | 0.5 | Any drawable width | Line thickness. A negative or non-finite width is refused and the stroke keeps the width it would have had, reported with OUT_OF_RANGE_OPTION_VALUE |
fill | none | Any color | Fill color |
opacity | 1 | 0-1 | Transparency |
Dots
DOT is the full-size dot, SDOT the small dot (used by indicators); COMMA rides the DOT family. Dot size is controlled separately from the line stroke, with two relative options and two absolute ones.
| Option | Default | Range | Description |
|---|---|---|---|
dot-extra-width | 0.333 | 0 or more | Relative extra width over the stroke for the DOT family. Bulk knob: SDOT follows at half. Rendered diameter = stroke-width + value |
sdot-extra-width | 0.1665 | 0 or more | Relative extra for SDOT only, overriding the dot-extra-width half-default |
dot-width | unset | 0 or more | Absolute rendered DOT diameter, independent of stroke-width. Overrides dot-extra-width |
sdot-width | unset | 0 or more | Absolute rendered SDOT diameter. Overrides sdot-extra-width and the half-default |
Precedence within a dot type: absolute wins over relative. These options cascade at every scope (global, word, character, part), like color and stroke-width.
Backgrounds and Links
These work at every scope. background is not inherited; the other four are, and in the global bracket they reach the backgrounds and links of words, characters and parts, never the picture's own background or a global link. See Backgrounds on Words, Characters and Parts and Linking by the Lines.
| Option | Default | Range | Description |
|---|---|---|---|
background | - | Any color | In the global bracket, the picture's background (and the default for the zones); on a word, character or part, a background behind that element alone |
background-area | box | box or ink | The shape of a word's, character's or part's background: a box, or a halo around its lines |
background-padding | 1, 0.5 or 0.4 | 0 or more | How far a background reaches past what it surrounds, in grid units: 1 around a word's or a character's box, 0.5 around a part's, 0.4 around each line of a halo |
link-area | box | box or ink | Where a link on a word, character or part answers a click: its whole area, or its lines and 0.4 around them |
link-padding | 1, 0.5 or 0.4 | 0 or more | How far a link's area reaches, with the same defaults as background-padding |
Spacing
| Option | Default | Range | Description |
|---|---|---|---|
word-space | 8 | 0 or more | Space between words |
char-space | 2 | 0 or more | Space between characters |
external-glyph-space | 0.8 | 0 or more | Space between external glyphs (X-codes) |
Positioning
These four are the exception to the scope note above: they are not canvas-wide, they position one element, and what they mean depends on which scope you write them at. They work identically in the DSL and through an options object ({ x: 5 }, { relativeKerning: -1 }), including the opts argument of addGlyph, insertPart, replaceGlyph and the rest of that family. A definition's defaultOptions cannot hold them, nor can the bracket that starts its codeString, since they place one use of a character rather than describe the character.
A part's x and y and the two kerning options are options only as you enter them: they are saved outside the bracket, as CODE:x,y and RK:/AK:, so a save without options and clearOptions() keep them. x and y at every other scope are saved in the bracket and go with the other options.
| Option | Scope | Description |
|---|---|---|
x | part [opts]> | Position inside the character. Same as the CODE:x,y suffix, and the option wins when both are written (MULTIPLE_POSITION_VALUES) |
x | character [opts] | Leading blank owned by the character: it widens the character and moves its ink in, without moving the character. See Positioning |
x | word [opts]|, global [opts]|| | Moves the word itself, measured from the end of what precedes it, so [x=0]| drops the word space back to a character space |
y | any | A plain offset at every scope, since nothing else decides the vertical |
relative-kerning | character [opts] only | The RK: marker as an option: adjusts the gap before this character. At any other scope it is dropped with a MISPLACED_KERNING_OPTION warning |
absolute-kerning | character [opts] only | The AK: marker as an option: sets the gap before this character. Same rule about other scopes |
One position per part and one kerning value per character, however you spell it. The last value written wins, an option beats the positional shorthand, and every value that loses is reported rather than dropped in silence.
Sizing & Layout
| Option | Default | Values | Description |
|---|---|---|---|
min-width | 0 | ≥0 | Minimum composition width |
center | off | boolean | Center content in available width |
Margins
| Option | Default | Type | Description |
|---|---|---|---|
margin | - | Number | All sides |
margin-top | 0.75 | Number | Top margin |
margin-bottom | 0.75 | Number | Bottom margin |
margin-left | 0.75 | Number | Left margin |
margin-right | 0.75 | Number | Right margin |
Cropping
| Option | Default | Type | Description |
|---|---|---|---|
crop | 0 | Number, auto, auto-vertical, compact | All sides or named mode |
crop-top | 0 | Number or auto | Crop from top |
crop-bottom | 0 | Number or auto | Crop from bottom |
crop-left | 0 | Number or auto | Crop from left |
crop-right | 0 | Number or auto | Crop from right |
Grid Visibility
| Option | Default | Values | Description |
|---|---|---|---|
grid | off | boolean | Show alignment grid |
Grid Colors
| Option | Default | Type | Description |
|---|---|---|---|
grid-color | - | Color | All grid lines (bulk) |
grid-major-color | #c7c7c7 | Color | Major lines (every 4 units) |
grid-medium-color | #ebebeb | Color | Medium lines (every 2 units) |
grid-minor-color | #ebebeb | Color | Minor lines (every 1 unit) |
grid-sky-color | #858585 | Color | Sky reference line (y=8) |
grid-earth-color | #858585 | Color | Earth reference line (y=16) |
Grid Stroke Widths
| Option | Default | Type | Description |
|---|---|---|---|
grid-stroke-width | 0.166 | Number | All grid lines (bulk) |
grid-major-stroke-width | 0.166 | Number | Major lines |
grid-medium-stroke-width | 0.166 | Number | Medium lines |
grid-minor-stroke-width | 0.166 | Number | Minor lines |
grid-sky-stroke-width | 0.166 | Number | Sky line |
grid-earth-stroke-width | 0.166 | Number | Earth line |
Grid Shift
| Option | Default | Type | Description |
|---|---|---|---|
grid-shift | 0 | Number | Moves every grid line right and down by this many grid units, or left and up when negative. The symbol and the picture's size stay. See Crisp Lines at Small Sizes |
SVG Output
| Option | Default | Type | Description |
|---|---|---|---|
svg-height | Auto | Number (px) | SVG element height |
svg-title | - | String | Accessible title |
svg-desc | - | String | Accessible description |
background-top | - | Color | Top zone background (above y=8) |
background-mid | - | Color | Mid zone background (y=8 to y=16) |
background-bottom | - | Color | Bottom zone background (below y=16) |
Error Handling
| Option | Default | Type | Description |
|---|---|---|---|
error-placeholder | off | boolean | Show visual placeholder for unknown codes |
Option Hierarchy
Options cascade from least to most specific:
- Global
[opts]||applies to everything - Word
[opts]|overrides global for that word - Character
[opts]overrides word for that character - Part
[opts]>overrides all for that part
Grid color/stroke options have their own hierarchy:
- Bulk (
grid-color) → Category (grid-major-color) → Specific (grid-sky-color)
One bracket per scope: combine options with ; ([grid;grid-color=red]||); a second bracket at the same scope is ignored with a MULTIPLE_OPTION_BRACKETS warning. Misplaced options are dropped with a warning and the content still renders; see Option Placement Is Checked.
Color Values
All color options accept:
- Hex:
#ff0000,#f00 - RGB:
rgb(255, 0, 0) - HSL:
hsl(0, 100%, 50%) - Named:
red,blue,green, etc.