Skip to content

bezborodow/celtic-knot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Celtic Knot Generator for SVG

celtic-knot is a Ruby programme that creates simple rectangular celtic knot drawings based upon a given set of parameters. The images are in a vector format.

Synopsis

The drawing is in SVG (Scaleable Vector Graphics) format, which is sent to standard output.

Usage

Usage: ./knot [options]
    -h, --help                       Prints this help
    -V, --vertical=VERTICAL          Number of cells vertically.
    -H, --horizontal=HORIZONTAL      Number of cells horizontally.
    -G, --cell-size=CELL_SIZE        Dimensions of each cell in the grid.
    -b, --background-color=BG_COLOR  Background colour.
    -k, --knot-color=KNOT_COLOR      Knot colour.
    -K, --knot-width=KNOT_WIDTH      Knot width.
    -s, --stroke-color=STROKE_COLOR  Stroke colour.
    -S, --stroke-width=STROKE_WIDTH  Stroke width.

Examples

Basic

Basic knot

./knot \
    --vertical=2 \
    --horizontal=2 \
    --cell-size=96 \
    --knot-color='white' \
    --knot-width=24 \
    --stroke-color=black \
    --stroke-width=8 \
    > basic.svg

Ingƿine

Ingƿine knot

./knot \
    --vertical=3 \
    --horizontal=4 \
    --cell-size=96 \
    --background-color='#012169' \
    --knot-color='#C8102E' \
    --knot-width=32 \
    --stroke-color=white \
    --stroke-width=16 \
    > ingwine.svg

Bratach (Banner)

Bratach knot

./knot \
    --vertical=5 \
    --horizontal=6 \
    --cell-size=64 \
    --background-color='#169B62' \
    --knot-color='#FF883E' \
    --knot-width=32 \
    --stroke-color=white \
    --stroke-width=4 \
    > bratach.svg

Converting SVG to Other Formats

The SVG file can be viewed locally in your Web browser or converted into other formats such as PNG using utilities such as ImageMagick's convert. For example:

convert -background none examples/basic.svg examples/basic.png

Installation

Fedora

sudo dnf install ruby rubygem-nokogiri
mkdir ~/src
cd ~/src/
git clone git@github.com:bezborodow/celtic-knot.git
cd celtic-knot
bundle install --local

Internals

API Documentation

Author

2023 Damien Bezborodov

Releases

No releases published

Packages

No packages published