Templates, palettes, sizes

What a new project can start from.

Templates

Templates are listed by kind in the gallery. The function gives the document a project starts as. A template that has an animation plays in the gallery while the pointer is on it.

templates: [['Example', [
  { name: 'Thumbnail', about: 'An empty 640 × 360 image with a dot in its middle.',
    make: () => ({
      template: 'Blank', name: 'Thumbnail', canvas_w: 640, canvas_h: 360, pixel: false,
      layers: [
        { id: 'panel', visible: false },
        { id: 'dot', kind: 'shape', name: 'Dot', shape: 'Ellipse', w: 160, h: 160, color: '#F0834F', radius: 0, stroke: 0 },
      ],
    }) },
]]],
from rassam import blank


@plugin.template('Thumbnail', kind='Example', about='An empty 640 × 360 image with a dot in its middle.')
def thumbnail():
    return blank(640, 360, name='Thumbnail', layers=[
        {'id': 'panel', 'visible': False},
        {'id': 'dot', 'kind': 'shape', 'name': 'Dot', 'shape': 'Ellipse', 'w': 160, 'h': 160, 'color': '#F0834F', 'radius': 0, 'stroke': 0},
    ])

In Python, blank(width, height, pixel_art=False) is an empty image; banner(...), card(...) and slot(...) are the program's designs, with what is given changed.

Palettes

palettes: { 'Example: dusk': ['#2D1B3D', '#6C2D5C', '#C2476B', '#F0834F', '#F7C56B', '#FFF1C9'] },
plugin.palette('Example: dusk', ['#2D1B3D', '#6C2D5C', '#C2476B', '#F0834F', '#F7C56B', '#FFF1C9'])

Sizes

Sizes go in the New image window: a group, whether it is pixel art, and each size as a name, a width and a height.

sizes: [['Screen', false, [['Thumbnail', 640, 360], ['Cover', 1600, 900]]]],
plugin.size('Thumbnail', 640, 360, group='Screen')
plugin.size('Cover', 1600, 900, group='Screen')
plugin.size('Icon', 32, 32, group='Pixel art', pixel_art=True)