iconscript

iconscript

iconscript is a language for describing pixel-wise pictograms in the style of the Röntgen project implemented in Rust and TypeScript. You can install it with:

Generating...

Syntax

Syntax

Syntax slightly resembles the syntax of path commands in SVG. Positions on the plane are coded as two floating point number separated by comma: x,y or +x,y. + means that the position is relative to the position.

If current position is (5, 5), `+1,2` will give (6, 7) and update current position to (6, 7) as well.

Global context

Global context

Commands

Commands
CommandDescription
subtract

Set subtraction mode

fill

Set fill mode

w float

Set width to a value

m position

Set position to a value

l [position]

Draw lines between positions

e position float

Draw circle specified by center point and radius

r position position

Draw rectangle specified by top left and bottom right points

a position float float float

Draw arc specified by center point, radius, and two angles in radians

Variables

Variables

Variables can be defined with <variable> = [<command>] and accessed with @<variable>.

Scopes

Scopes

Scopes group commands together using { and }. They can be nested and are used to incapsulate context changes.

Example

Example
square = {fill r +0,0 +2,2}
icon glider = {
    m 6,2   @square m +4,4 @square
    m +-8,4 @square m +4,0 @square m +4,0 @square
}

This code defines a square (filled rectangle). It then reuses square variable 5 times to draw a glider.