Help on the Tartan Generator

The input form The .TDF output The tartan output

The Input Form

These are the colours you can use. The letters are their "names", which will be used to specify the warp and weft sequences.

You can change the colours to ones you find more suitable.

One of them, 'tr', is transparent.

You must specify the warp sequence, and (if different from the warp) the weft sequence of a tartan.
You may select a tartan that is already defined in a .TDF file.
You may specify repeat counts for each thread, and for the whole image.
You may modify the colour scheme used for the tartan.
You may specify the type of the image that is created.
You may specify the fine details of the weave.
When you have specified everything you want, click "Draw" and see the tartan appear.

To get to this "help" page, click "Help".

To clear all inputs, click "Clear".

The colours

There are 29 configurable colours. Each is shown as a square patch of colour, with its name shown over it in black and in white (to ensure that one version is visible). This is the name you use to refer to the colour when specifying a warp or weft sequence. The names are all single letters like 'r', or two letters like 'pr'.

If you hover your cursor over a colour for a moment, you will see its r,g,b values displayed, like this.

If you need a colour that is not shown, choose one that you will not be needing, and configure it to be the colour that you want. To do this, click on the square that you want to change (click on the bottom half of the square, to ensure that it is not its name you are clicking on), and you will be asked to say how much red, how much green, and how much blue there is in the colour that you want. You should answer this question by typing three numbers in the range 0..255, separated by spaces (or by any non-numbers). If you type in other things, it won't do any harm, it will just assume that you meant to type 0, and you will end up with black. When you have supplied the three numbers, your colour will appear in the square, and is ready to use.

One of the colours, named tr, is transparent. You can't configure this colour. It is probably not sensible to have transparent threads in a tartan, but it was easy to implement. If you make an image using transparent threads, use html to place it over some other image, and view the result with a fairly recent browser, you will see through the transparent threads to the other image. However older browsers do not support tranparency, and will show the transparent threads as very pale yellow.

Occasionally you may see a missing image, like the one to the right. This does not do any harm, it just means that the image has got lost somewhere on the way to you from the server. You can ignore it and use the program in the usual way. Or, you can correct it by clicking on the missing image and then hitting the enter key.

Warp and Weft Sequences

You must specify a warp sequence for a tartan – you may ignore all the other inputs. You may also specify a weft sequence.

A sequence is specified by using pairs of colour-names and numbers. The colour names are those defined above. In this section we will assume that you have r set to a red colour, g to a green colour, w to white, and b to a blue colour. So r5 means five red threads; and b1w3 means a blue thread followed by three white threads.

To the left of where you input the warp sequence, there is a box like this: . If you click on it, it changes to look like this: ; and if you click again, it changes back again. While there is a tick in this box, the sequence is "mirrored", and while there is no tick in this box, the sequence is not mirrored, but handled direct as input.

The unmirrored input is easy to explain. If you have the warp specified like this: , the warp sequence will be three green threads, six white threads, three blue threads, six white threads.

If the sequence is mirrored, there are three places for your input. The first and the last of these (the pivots) may each contain only one colour-name/number. The middle one may contain a sequence, and it is this sequence that is mirrored. Thus if you have the warp specified like this: , the entire warp sequence will be: one green; four reds, two whites; three blues; two whites, four reds.

If the sequence is mirrored, you may fill in all three of the input boxes that define the weft sequence, or just two of them, or just one of them.

You may also specify a weft sequence. If you do not specify a weft sequence, the weft will be the same as the warp. Almost all tartans have the weft the same as the warp.

Selecting a pre-defined Tartan

Robert Bradford has kindly allowed me to use some "tartan definition format" files, or .TDF files, which he has created. These are listed in this list box. If you select the name of a tartan listed here, it is immediately drawn. There are about 275 of these definitions.

Any settings further down the screen are applied to the tartan. If you want to see it as defined, click on "Clear" first, to clear these settings.

TDF files contain not only sequence information, but colour information. The act of selecting a pre-defined tartan overwrites some of the colours defined and shown above. It is changed as if you had changed it yourself.

Repeat Counts

You may define two repeat counts for the image you are creating: the threads repeat and the image repeat.

The threads repeat multiplies each separate thread in the warp and the weft. If there were three green threads and a red thread, and you set the threads repeat to 2, there will be six green threads and two red threads. This makes it easier to see the detail of the tartan.

The default value for the threads repeat is 1. It may take any value from 1 upwards. If it is not a whole number, it still works, but some threads will be multiplied more than others, which may not be what you want.

The image repeat multiplies the whole image (in both directions). This may give a better idea of what the tartan looks like. However, by increasing the total size of the resulting image, it increases the time that it will take to create and to download the image.

The default value for the image repeat is 1. It may take any value from 0.5 upwards. If it is not a whole number, it still works, but the resulting image will not tile. It is recommended that you use a whole number here.

Gow tartan:
default settings
Gow tartan:
threads repeat = 2
Gow tartan:
image repeat = 2

Modifications to Colours

These three controls, "Mute", "Darken", and "Rotate", alter the colours which will be used to draw the tartan. They do this after reading the warp and weft sequences. The colours as defined above, and the .TDF output, are not affected.

"Mute" moves every colour towards grey, without making it darker or paler. The default value is 0, which has no effect. Any higher number may be used. The higher the number, the greyer the colours become.

"Darken" makes every colour darker. The default value is 0, which has no effect. Any number may be used. Positive numbers make colours darker, negative ones make them paler. The larger the number, the stronger the effect.

If you intend to use the tartan as "wallpaper", with text displayed over it, then use a negative value of "Darken". The wallpaper on this page has a "Darken" value of -3.

If you are trying to get a particular effect, it can be sensible to try various combinations of "Mute" and "Darken".

"Rotate" rotates the set of colours by the specified angle, clockwise around the ring shown to the right. The rotation is measured in degrees, and must be in the range 0–360. Values of 0 and 360 have no effect. Thus 120 transforms a pure red to a pure green, etc. 240 transforms a pure red to a pure blue, etc. 60 transforms red half-way towards green, so that red becomes yellow, green cyan, and blue magenta. 30 transforms red a quarter of the way towards green, so that it becomes orange.

Unlike "Mute" and "Darken", what "Rotate" does is not sensible. However it was easy to implement, and can be fun to play with. Just set "Rotate" to, say, 90, and select a pre-defined tartan from the list.

Gunn tartan:
default settings
Gunn tartan:
Mute = 2
Gunn tartan:
Darken = 0.5
Gunn tartan:
Darken = -2
Gunn tartan:
Rotate = 240

Image type

You can specify whether the image is created as a .PNG, as a .JPG, or as a .GIF. The default is .PNG, and this is recommended, as for tartans .PNG files are smaller. The .GIF format was formerly not offered because of copyright problems, but is now available.

Weave type

You may specify the details of the weave – how the image is constructed in terms of pixels. This is best illustrated by examples, here magnified by a factor of 10.
d0 d1 d2
s0 s1 s2
s3 s4 s5
These tartans are all the same apart from the weave. Their .TDF file is:
v#80ff80
g#008000
w#ffffff
r#ff0000
v3g1
w3r1
For the s3, s4, and s5 weaves, an extra colour is used, to represent the "gaps between the threads". Which colour to use is specified in the "Fill" control. If one of these weaves is chosen, then some colour must be specified for "Fill". If any other weave is chosen, a colour need not be specified, and any colour that is specified has no effect. For the example above, the "Fill" was set to black.

The d2, s4 and s5 weaves are the only one to show the "twill" pattern which characterises tartans, with each warp thread going over two weft threads then under two weft threads, and vice versa.

The .TDF Output

When you click on "Draw", or select a pre-defined tartan from the list, the program outputs the tartan definition as a .TDF file in a box above the tartan itself, like this. It is provided in case you want to copy its contents. You can type into this box if you like, but this has no effect on anything.

.TDF files

.TDF, or "Tartan Definition Format", files were defined by Robert Bradford for use with his mktartan program. This program, in C, could once be downloaded, compiled, and used to create tartan images. He had also provided a folder http://www.holestone.net/tartan/tdf/ of .TDF files, which have been incorporated, with his permission, into this program.

The format of a .TDF file is fairly obvious. It starts with some colour definitions, each on one line, and then has the warp sequence on another line, and the weft sequence, if different from the warp sequence, on the final line. Parentheses with a sequence indicate that it is repeated, backwards. Thus the .TDF for the Austin tartan is

k#000000
g#004c00
b#00004c
k2(g9b4k4)b4
so the full sequence for the warp (and the weft) is
k2 g9 b4 k4 b4 k4 b4 g9.
The Ancient MacMillan tartan has no brackets:
g#004c00
k#000000
r#c80000
y#c8c800
g2k1g18k1g2k1r12g4y6k1y6k1
and so has less symmetry than most tartans.

The Tartan Output

The tartan is output as a .PNG image, a .JPG image, or a .GIF image. This is displayed in your browser. If you right-click on the image, you will probably (depending on your browser) be able to save it and use it as you wish.

You may intend to use the tartan image to tile something, for example your Windows background, or a web page background. If you want the image to tile properly, you must either ensure that the number of weft threads equals the number of warps threads (this will happen anyway if you don't specify a warp, and is the case for all the pre-defined tartans), or use a weave type s0, s1, s2, s3, s4 or s5.

If you intend to use the image for tiling, you should set the image repeat to 1. If it is not a whole number the image will not tile. If it is larger than 1 you will be creating an unnecessarily large image.


This is the help for a tartan-drawing program. It was last updated on 2024-09-27.

Some links to information about tartans.