napkin-sketchdocs 1.0.0 GitHub

Cheatsheet#

On this page

Every shortcut, flag, and script on one page. New here? Start with QUICKSTART.md. Full prose reference: Using the app, which the documentation site publishes and Help > Verbose opens. The API on one page: API-CHEATSHEET.md.

Ctrl is Cmd on macOS throughout. The keys are the app's own; Edit > Edit Keyboard Shortcuts changes them for you alone.

Tools#

ToolKeyNotes
BrushBPressure-aware variable width
MarkerM
Copic markerKFlat broad nib, rotatable
PencilNGraphite and charcoal by hardness, through the paper's grain; press for the drawing kit
SmearShift+NA blending stump: drag over pencil marks to spread their graphite; Quick Width sizes it, Quick Opacity sets its strength
EraserECuts the selection, or every mark it touches, out of the drawing
Shape EraserShift+EDrag a shape to cut it out of the selected marks; press for the shapes
Shape StackerShift+MDrag across the pieces of the selected shapes to merge them, Alt to take them away; press for the Wipe Stacks
SplitJClick a path to cut it where you click, as scissors do; a closed one opens there
SelectSBlack arrow; active at launch
Direct SelectAWhite arrow; picks, moves and deletes anchor points and segments
TextTClick = new text or edit a text, in or along a selected path; drag = text box
RectangleRHold Shift for a square
EllipseLHold Shift for a circle
CurveVClick and hold the button for the free-ends variant
Vector PathPClick = corner, drag = smooth Bezier point
Paint BucketGFills the enclosed shape under the click
Fill ColortoolbarFills the element under the click, else the selection
EyedropperIHold Ctrl to pick a shape instead
Mesh WarptoolbarClick art to mesh it, then drag its pins to bend it
LiquifyShift+RBend the marks under a brush - Warp, Twirl, Pucker or Bloat; press for the four

Drawing#

ActionShortcut
Straight linePress, then hold Space
Lock a line to 45 degreesShift mid-drag (release to free)
Shift-click lineClick or draw, then Shift + click
Quick curve (ellipse)Press, then hold Ctrl + Space
Quick curve (circle)Press, then hold Ctrl + Space + Alt
Swing a quick curve apexShift, 90 degrees clockwise per press
Endpoint snapHold Shift while drawing
Select with a drawing toolHold Ctrl (the last selection tool chosen)
Rotate the Copic nibHold Ctrl still 1s, then Alt (CW) / Shift (CCW)
Cancel the stroke in progressEsc
Sharpen allH
Sharpen SelectionTransform > Sharpen, or the toolbar button

Text editing#

The type editor's own keys, while a text is edited (Type).

ActionShortcut
New text / edit a textT and click; or double-click a text with Select
New lineEnter
Put the text downEsc or Ctrl + Enter
Select a word / a paragraph / allDouble-click / triple-click / Ctrl + A
Move by word / paragraphCtrl + Left Right / Up Down
Line start or end / text start or endHome End / Ctrl + Home Ctrl + End
Size up / down 2 pt (10 pt)Ctrl + Shift + . / , (add Alt)
Leading down / up 2 ptAlt + Up / Alt + Down
Kerning or tracking +20 / -20 (x5)Alt + Right / Alt + Left (add Ctrl)
Baseline shift up / down 2 ptAlt + Shift + Up / Alt + Shift + Down
Align left / center / right / justifyCtrl + Shift + L / C / R / J
All CapsCtrl + Shift + K
Horizontal scale back to 100%Ctrl + Shift + X
Tracking and kerning back to 0Ctrl + Alt + Q
Paste plain textCtrl + Shift + V

Quick features#

ActionShortcut
Quick widthW then a number
Quick opacityQ then a number
Quick zoomZ then a digit (9 = 90%, 0 = 100%)
Cycle Quick Access ColorC forward, Shift + C back

View, pan, and zoom#

ActionShortcut
Fit All in ViewCtrl + 0
Zoom In / Zoom OutCtrl + + / Ctrl + -
Zoom (mouse)Hold Alt and scroll
Pan (mouse)Scroll; Ctrl + Shift + scroll pans across
Pan (any tool)Hold Space and drag
Pan / zoom (touch)Two-finger gesture
Open the menu barAlt alone, after 5 s with no other key
Toggle Pages panelCtrl + B
Previous / next pagePageUp / PageDown
Toggle Layers panelCtrl + L
Toggle Properties panelCtrl + P
Toggle Appearance panelShift + F6
Type panel: CharacterCtrl + Shift + T
Type panel: ParagraphCtrl + Alt + T
Quick SettingsCtrl + ,
Verbose SettingsCtrl + Alt + ,
Animation ModeCtrl + Shift + N (experimental add-on)

Selection and editing#

ActionShortcut
Select allCtrl + A
Deselect allCtrl + Shift + A
Add to / remove from selectionShift + click
Rubber-band selectDrag over empty space (Select tool)
Pick anchors or segments with a boxDrag over empty space (Direct Select): anchors when it holds any, else segments
Move picked anchors or segmentsDrag one, or the arrow keys, Shift for 10 (Direct Select)
Delete picked anchors or segmentsDelete or Backspace (Direct Select): a closed path opens
Drag-copy the selectionHold Alt and drag
Cut / Copy / PasteCtrl + X / Ctrl + C / Ctrl + V
Paste in PlaceCtrl + Shift + V
DuplicateCtrl + D
Delete selection or layerDelete or Backspace
Move by a distanceEnter, or the Move button
Step a Move fieldArrow keys, Shift for a coarse step
RotateCtrl + R, Transform > Rotate, or the Rotate button
Snap a rotation to 15 degreesShift while dragging, or the Snap toggle
Join strokesCtrl + J
Apply Last Effect againCtrl + Shift + E
Last Effect, its options openCtrl + Alt + Shift + E
Combine shapes, as PathfinderTransform > Wipe Stacks, or right-click the canvas
Merge pieces, as Shape BuilderShape Stacker (Shift + M): drag across them; Alt takes them away
Cut a path, as ScissorsSplit (J): click it where it should come apart
Blend pencil into shadingSmear (Shift + N): drag across it; W sizes the stump, Q sets its strength
UndoCtrl + Z
RedoCtrl + Y or Ctrl + Shift + Z

Vector path editing#

With the Vector Path tool active, click a committed path to open its anchors.

ActionShortcut
Add an anchorClick a segment (a + badge marks the spot)
Remove an anchorClick the anchor (a - badge marks it)
Move an anchor or handleHold Ctrl and drag
Round a cornerHold Ctrl, drag the target icon, or type a Radius
Toggle an anchor's handlesAlt + click the anchor
Hold a point to 45 degreesHold Shift while placing it or pulling a handle
Close the pathClick the first point where the close ring shows
Finish it openEnter, double-click, or switch tools
Abandon the pathEsc
Put an edited path downClick empty canvas, or Esc

Layers#

ActionShortcut
Toggle the panelCtrl + L
Rename the active layerF2 or double-click the row
Group the selected layersCtrl + G
UngroupCtrl + Shift + G
Make a clipping maskCtrl + 7; the closed path on top clips
Release a clipping maskCtrl + Alt + 7
Move layer up / downCtrl + ] / Ctrl + [
Move layer to top / bottomCtrl + Shift + ] / Ctrl + Shift + [
Select layer above / belowAlt + ] / Alt + [
Multi-select rowsShift + click
Restack or nestDrag the row (drop onto a group to nest)
Layer tools menuRight-click a row

Files#

ActionShortcut
New SketchCtrl + N
OpenCtrl + O
ImportCtrl + I
SaveCtrl + S
Save AsCtrl + Shift + S
ExportFile > Export > PNG / SVG / JPEG / PDF

Nine menus: File, Edit, View, Transform, Sketch, Layers, Pages, Automate and Help. What each one holds is in the menus table.

ActionWhere
Change a tool's keysEdit > Edit Keyboard Shortcuts
List a tool in another menuEdit > Edit Tool Types
Read this documentationHelp > Verbose
A menu's quickstartHelp > Tool Types
The project's pageHelp > Source Code
Version, license, noticesHelp > About napkin-sketch
Back / forward in the docsAlt + Left / Alt + Right

Automate#

ActionWhere
Script an SVG, PDF or pictureAutomate > Generate Script > From Media File
Script the lit layersAutomate > Generate Script > Selected Layers
Record every stepAutomate > Track History
Keep more or fewer steps (500; 50-5000)Automate > History Limit
Script the steps, leaving some outAutomate > Generate Script > From Session History

CLI#

napkin-sketch [option] [target]
FlagDescription
-h, --helpShow command-line help
-v, --versionShow the version, and where the desktop app is
-b, --bookOpen a saved .skbk sketch book
-n, --newNew sketch, named unnamed or [target]
-f, --full-screenOpen full screen (the default window is maximized)
--no-sandboxLaunch without Chromium's sandbox: Linux development only
-i, --importImport an SVG, PDF, PNG, JPEG, GIF or WebP into the opening sketch
-m, --multiple-importsImport a comma-separated list, laid out in a grid
--sharpenAuto-sharpen a saved sketch on disk, then open it
--install-guiInstall the desktop app and Electron, about 100 MB
--uninstall-guiRemove it; --here with either, for this project
[target]A .skbk file to open, or a name for a new sketch
napkin-sketch --install-gui                          # add the desktop app (about 100 MB)
napkin-sketch                                        # new blank sketch
napkin-sketch --new ideas                            # new sketch named "ideas"
napkin-sketch --book ./notes.skbk                    # open a saved book
napkin-sketch ./notes.skbk                           # same, bare path
napkin-sketch --sharpen ./notes                      # sharpen on disk, then open
napkin-sketch --new -f                               # full screen
napkin-sketch --import logo.svg                      # import one file
napkin-sketch -m logo.svg,"site map.svg",photo.png   # grid of files

Quote file names that contain spaces.

Commands (no window, no Electron)#

CommandDoes
draw <script | ->Draw to files: --to svg,png,pdf,skbk,jsx --out <dir>
check <script | ->Read and run, report problems, write nothing
render <book.skbk>Write a book as files; --page <n> for one page
verbsThe language by category; --json for the table
napkin-sketch draw card.napkin --to svg,png          # card.svg, card.png
napkin-sketch draw card.napkin --to jsx              # card.jsx, for Illustrator
napkin-sketch draw --prompt "a three-box flowchart"  # an AI tool writes the script
napkin-sketch draw - --json < card.napkin            # stdin in, one JSON line out
napkin-sketch draw card.napkin --asset logo=logo.png # an image the script names
napkin-sketch check card.napkin --strict             # fail on warnings too
napkin-sketch render deck.skbk --to png --page 2     # deck-2.png
napkin-sketch render hero.skbk --animate walk        # hero-walk-1.svg on: frames, no AI
napkin-sketch verbs --category shapes                # one category
ExitMeaning
0Drew
1The arguments were wrong
2The script had errors (files still written unless --strict)
3A file could not be read or written (a linked file included)
4The AI helper gave back no script (draw --prompt)

npm scripts#

ScriptWhat it does
npm run buildBundle CLI, main, preload, renderer, and the embed API
npm run build:watchRebuild on change
npm run build:typesEmit .d.ts declarations for the embeddable API
npm run typecheckType-check without emitting
npm testRun the unit test suites
npm test -- --keep-graphicsKeep the graphics the graphic-design suite draws
npm test -- --update-goldenRewrite the golden SVGs in test/scripts/
npm run gui-checkDrive the built app and check what it shows (build first)
npm run gui-check -- --backgroundThe same, off the screen and out of the focus
npm startBuild, then launch a new sketch
npm run cleanRemove dist/
npm run import-tree -- <file.svg>Print the layer tree an SVG would import as
npm run todoArchive checked TODO.md items into its Complete section
npm run ai-helper -- --listShow AI tool targets and the helpers that install to them
npm run ai-helperInstall every helper's skills to .claude
npm run ai-helper -- --to githubInstall them to .github (Copilot) instead
npm run ai-helper -- --helper <name>Narrow to one helper (vectors, graphic-designer, scripting)
npm run ai-helper -- --to pluginCheck the plugins and print the /plugin commands
npm run wireframe-cyclesRebuild the animation cycle tables from the wireframe asset
npm run shape-libraryRebuild the script shape library from its SVG assets
npm run shape-library -- --checkFail when the committed shape library is out of date
npm run api-docsRewrite the API docs' generated tables, schema and index
npm run api-docs -- --checkFail when any of them is out of date
npm run menu-docsRewrite the shortcut tables from the menu registry
npm run menu-docs -- --checkFail when either is out of date
npm run pack-checkPack and install both packages: draw with one, find the app
npm run pack-guiLay out the desktop app's npm package in release/gui/
npm run distBuild an installer for the current OS
npm run dist:win / dist:mac / dist:linuxNSIS / DMG / AppImage
npm run animation-mode -- --statusIs Animation Mode installed?
npm run animation-mode -- --installInstall it (defaults to Claude Code)
npm run animation-mode -- --uninstallRemove it again

Embedding#

import { NapkinSketch } from '@isocialpractice/napkin-sketch';
import '@isocialpractice/napkin-sketch/styles.css';

const editor = new NapkinSketch(document.getElementById('host')!, {
  liveSharpen: false,
  onChange: (e) => console.log(e.toJSON()),
});

editor.setTool('pen');
editor.sharpenAll();
editor.toDataURL('image/png');
editor.toSVG();
editor.toPDF();
editor.applyCompositionStyle(style); // restyles by layer name; gives the report

Pure-engine entry points, no editor required: sharpenStrokes, parseSketchBook, sketchesToPdf, and importSvg (browser only).

Drawing from a script#

import { drawSvg, evaluate, renderBook } from '@isocialpractice/napkin-sketch';   // anywhere
import { drawFile, drawToFiles } from '@isocialpractice/napkin-sketch/node';      // Node: files

const { svg, diagnostics } = drawSvg('napkin 1\npage 400 300\ncircle 200 150 60');
const { ok, files } = await drawFile('card.napkin', { out: 'out', formats: ['svg', 'png', 'pdf', 'skbk'] });
CallGives
evaluate(script, options){ ok, book, diagnostics, stats, output }
renderBook(book, { format, ...output })svg/png: one a page; pdf/skbk/jsx: one string
drawFile(path, options), drawToFiles(script, options){ ok, files, diagnostics, stats, warnings }, files written

References: docs/api/node, docs/api/output.

The twenty verbs most scripts use:

VerbExampleDraws or sets
napkinnapkin 1The language version: the first line
pagepage 400 300, page a4 landscapeThe page size
backgroundbackground #fcfaf5, background noneThe page color
layerlayer "Sky" opacity 0.8A layer the marks after it go on
groupgroup "Figure" { layer "Head" }A group layer around a block
colorcolor #1f2328The ink
widthwidth 3The stroke width
fillfill #ffe08a, fill noneThe fill of closed shapes
rectrect 20 20 360 80 r 12A rectangle, rounded with r
circlecircle 50% 50% 48A circle
ellipseellipse 200 150 120 60An ellipse
lineline 20 20 380 280A straight line
polygonpolygon 200 40, 360 260, 40 260 r 8A closed shape through points
pathpath "M20 20 C60 0 100 40 140 20"SVG path data, or a block of steps
throughthrough 20 100, 80 40, 140 100A smooth curve through points
texttext "Acme Corp" at 200 70 size 28 align centerA text item
imageimage "logo" at 20 20 size 120An image the host passed in
linklink "assets/logo.svg" at 20 120 size 120 120A linked file, drawn where it can be
repeatrepeat 10 as i { rect (20 + i * 36) 20 30 30 }A block, a number of times
roughrough 0.6The hand-drawn pass

Every verb, flag and exit code: API-CHEATSHEET.md. The map of the documentation: API.md.

Graphic design API#

import { createComposition } from '@isocialpractice/napkin-sketch';

const design = createComposition({ width: 360, height: 360, background: '#f6f7f9' });
design.rect({ x: 24, y: 24, width: 312, height: 96, rx: 12, fill: '#326478' });
design.text({ x: 180, y: 78, text: 'Acme Corp', align: 'center', fill: '#ffffff' });
design.defineClip('badge', { type: 'circle', cx: 180, cy: 220, r: 64 });
design.image({ src: logo, x: 116, y: 156, width: 128, height: 128, fit: 'cover', clip: 'badge' });

design.toSVG();  // string
design.toPNG();  // PNG bytes, no canvas and no image dependency
ElementMethod
Rectanglerect({ x, y, width, height, rx })
Circlecircle({ cx, cy, r })
Ellipseellipse({ cx, cy, rx, ry })
Triangletriangle({ x, y, width, height, variant }) or points
Polygonpolygon({ points }) / polyline({ points })
Lineline({ x1, y1, x2, y2 })
Pathpath({ d }) - M L H V C S Q T Z, no arcs
Texttext({ x, y, text, ...font and paragraph styling })
Mediaimage({ src, x, y, width, height, fit, clip })
Groupgroup(props, (g) => { ... })
MaskdefineClip(id, shape), or clip: inline on an element
Effectseffects: [{ type: 'drop-shadow', dx, dy, blur, color }]

Page defaults: 360 by 360, px, transparent, headless. Full reference in the graphic design API.

AI helpers (experimental)#

Three plugins in ai-helper/, one folder each, all listed by the marketplace at the repository root. All three are experimental: each runs an AI tool you install and sign in to yourself.

HelperCommandWhat it does
vectors/vectors:animation-modeDraws the next Animation Mode frame
graphic-designer/graphic-designer:design-languageReads an asset into a DESIGN_LANGUAGE.md
scripting/scripting:drawWrites a napkin script from a request
/plugin marketplace add .                              # from a clone
/plugin marketplace add isocialPractice/napkin-sketch  # without one
/plugin install vectors@napkin-sketch
/plugin install graphic-designer@napkin-sketch
/plugin install scripting@napkin-sketch
# What design language is this asset in?
node ai-helper/graphic-designer/skills/design-language/scripts/analyze-media.mjs asset.svg --markdown

An SVG yields colors, type, strokes and structure; a PNG yields colors only; JPEG and GIF have no decoder and say so rather than returning an empty result.

Defaults worth knowing#

SettingDefault
Active tool at launchSelect
Live sharpenOff
WindowMaximized; 1280x860 when restored down
Zoom range20% to one page pixel across the canvas
Endpoint snap sensitivity10px (range 1-20)
Join stroke on snapOff
Select sensitivity4px (range 1-20)
Direct Select sensitivity8px (range 1-20)
Eyedropper sensitivity10px (range 1-36)
Freehand fidelity1.5px (range 0.5-8)
Copic nib hold time1s (range 0.5-2)
Copic rotate width multiplier2x (range 1-4, capped at 40px)
Show selection bordersOn
Animation ModeNot installed