Skip to content

About

Tartan-Maker is a Python package and command-line tool for defining, validating, rendering, and exporting tartan designs

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

tartan-maker

GitHub Homepage

CI GitHub Pages PyPI Python versions License: MIT Ruff

tartan-maker is a Python package and command-line utility for defining, validating, rendering, and exporting tartan designs from YAML.

It is deliberately SVG-first: the package builds clean SVG from structured tartan data, and PNG output is derived from that same SVG. One rendering model, one source of truth, no separate raster engine slowly wandering off into the moor.

Black Watch / Government tartan preview Buchanan tartan preview Royal Stewart tartan preview

What it does

  • Defines tartans as readable YAML.
  • Supports symmetrical setts with explicit pivot markers.
  • Supports asymmetrical/direct setts without pivot markers.
  • Validates palettes, threadcounts, pivots, unused colors, and repeat sizes.
  • Renders SVG with separate warp and weft threadcount groups.
  • Exports PNG through the optional CairoSVG backend.
  • Emits Scottish Register of Tartans-style Pallet: and Threadcount: fields.
  • Resolves web color names and hex colors.
  • Uses spdlog for CLI logging.

Installation

Requires Python 3.11 or newer. Install the CLI from PyPI. The required spdlog binding may need to compile from source when a suitable wheel is unavailable, so a C++ compiler may be needed:

python -m pip install tartan-maker

To enable PNG output as well as SVG:

python -m pip install "tartan-maker[png]"

Verify the installation:

tartan-maker --version

For development from a repository checkout, use python -m pip install -e ".[dev,png]".

Quick start

From a repository checkout, render one of the reference examples (the examples/ directory is not installed with the CLI wheel):

tartan-maker render examples/black-watch.yaml -o black-watch.svg

Render PNG instead:

tartan-maker render examples/royal-stewart.yaml -o royal-stewart.png

Inspect a tartan:

tartan-maker inspect examples/buchanan.yaml

Generate SRT-style fields:

tartan-maker srt examples/macleod-of-lewis.yaml

Check the installed version:

tartan-maker --version

Documentation

The project site is built with MkDocs and published through GitHub Pages:

pip install -e ".[png]"
pip install mkdocs mkdocs-material mkdocstrings[python]
mkdocs serve

The docs workflow runs the unit tests on every commit and publishes the site on pushes to main.

Examples

The examples/ directory contains reference encodings used for testing and demonstration:

File Sett type Source
black-watch-government.yaml symmetrical Scottish Register of Tartans ref. 277
balmoral-original.yaml symmetrical Scottish Register of Tartans ref. 182
rob-roy-macgregor.yaml symmetrical Scottish Register of Tartans ref. 3516
buchanan.yaml asymmetrical Scottish Register of Tartans ref. 414
royal-stewart.yaml symmetrical Scottish Register of Tartans ref. 3958
macleod-of-lewis.yaml symmetrical Scottish Register of Tartans ref. 2630

These examples are not original design filings. They are practical sample inputs for exercising the parser, validator, renderer, and exporter.

Development

Run the tests:

python -m pytest -q

Run the linter if installed:

ruff check .

Build release distributions:

python -m build

See CONTRIBUTING.md for the development checklist and CHANGELOG.md for release history.

License

MIT. See LICENSE.

About

Tartan-Maker is a Python package and command-line tool for defining, validating, rendering, and exporting tartan designs

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages