Prev Up Next
User Interface Developer's Guide

File Format

Sketch stores drawings in plain ASCII files using a line oriented format. The main idea is that each line of an sk file looks like a Python function call. Originally, this was just for convenience, as the import filter just had to define all those functions in a dictionary, and read and (r)eval each line.

That turned out to be quite slow, probably because each line is compiled to bytecode and then executed just once. Sketch now uses a parser written in C. This is much faster and doesn't have the potential security problems of eval.

All function arguments are Python literals, ints, floats, strings (delimited with single- or double-quotes, the usual \ escapes are allowed, but no triple quoted strings or raw strings), tuples and lists. Keyword arguments are also allowed.

Boolean values are represented as the ints 0 or 1.

Colors are represented by float triples describing the RGB values, each inthe range 0..1 (e.g. red (1.0, 0.0, 0.0)).

All sk files start with '##Sketch' followed by two numbers, the major and minor version number of the file format.

Lines starting with # are comments, empty lines are ignored.

Overall structure

Globals

Layers

Objects

Properties


User Interface Developer's Guide
Prev Up Next