napkin-sketchdocs 1.0.0 GitHub

Composition Styles#

On this page

New in 1.0.0-alpha.5.0.0.

At a glance#

The panel#

View > Toggle Composition Styles Panel (Shift+F5) opens it, docked the first time beside the other panels; it moves, docks and closes as they do.

The buttons under the list:

ButtonDoes
NewRecords the page's named layers as a new style: for each name, the layer's opacity, blend, visibility and effects, what every text under it shares, and what every path under it shares. Names the app gave (Layer 3, Group 1, Brush 12) are left out.
DuplicateA copy of the chosen style, to change without losing the first.
DeleteTakes the chosen style out of your library. The report it leaves offers Put it back while it is up.
ImportAdds a style from a file. A file that is not a style is reported, a row for each problem.
ExportSaves the chosen style as a JSON file.
EditThe chosen style's name and its rules, in the editor below.

Your styles are yours, not a sketch book's: they live in the app's own folder, one file a style, and every book can use them.

Editing a style#

Edit opens the style in the configuration popup: its Name over the table, and a row for each rule.

ColumnHolds
KindLayer, Text or Stroke: what the rule styles.
Layer nameThe layer the rule names. The names on this page are suggested as you type.
StylesWhat the rule sets, in a few words, and Edit..., which opens the rule's fields.
From SelectionFills the rule from the selected mark's layer, or the active layer: what a capture of that layer would set.
xTakes the rule out.

Add Rule adds a row, and Save writes the style; a rule with no layer name is left out. A rule's Edit... lists every field its kind may set, each with a check: a checked field is one the rule sets, and an unchecked one stays as it is. Effects, a gradient and a list are written as the style file writes them.

What a rule sets#

KindReachesSets
LayerThe layer it namesOpacity, blend, Isolate Blending (a group's), visibility and effects. A fill and a stroke color for every mark under it too, unless a text or stroke rule names the same layer.
TextThe text on the layer and every layer under itAny character or paragraph attribute (font, style, size, leading, tracking, capitals, color, alignment, indents, spacing, lists and the rest), a Text Configuration by name, Markdown Flow on or off, a Clean Language Accent, effects and a blend.
StrokeThe paths on the layer and every layer under itThe outline's color, width, style and profile, No Stroke, the fill or a gradient, opacity, effects and a blend.

Matching a name#

A rule matches a layer whose name is the same once both are trimmed, in any case: background matches Background. Every layer of that name matches, and a rule reaches the layers under it.

The report#

A style that does not go wholly as asked raises a report at the bottom right (see Settings for how long it stays): Midnight: 2 rules did not match, with a row for each thing. A row says:

A style that goes as asked says Applied Midnight, and nothing else.

The file#

A style is JSON, the same in the app, on the command line and in code:

{
  "napkinCompositionStyle": 1,
  "name": "Midnight",
  "layers": {
    "Background": { "fill": "#000133" },
    "Badge": { "blend": "stack", "effects": [{ "type": "outer-glow", "blur": 6, "color": "#4cae50" }] }
  },
  "text": { "Title": { "config": "Heading", "color": "#ffffff", "align": "center" } },
  "strokes": { "Outline": { "color": "#4cae50", "width": 2, "strokeStyle": "dashed" } }
}

Every field is optional. The format is a JSON Schema too, and the compose reference lists every field.

On the command line and in code#