Tartan Definition File

May 15, 2018

ABNF description of Tartan Defintion File

Robert Bradford created a mktartan program. This was collected from the web and saved as a Github repository by Stewart C. Russell in 2015. The original definition of the Tartan Definition File is below and I have abstracted an ABNF definition here:

tartan_definition_file = *colour_description (tartan_pattern / (warp_pattern weft_pattern)

warp_pattern = tartan_pattern

weft_pattern = tartan_pattern

colour_description= hex_colour colour_letter

hex_colour = '#' 6HEXDIG ; representing RGB

colour_letter = %x61-7A ; Lower case letters

tartan_pattern = *thread_description [reflection_pattern] *thread_description

reflection_pattern = '(' *thread_description ')'

thread_description = colour_letter *DIGIT

Notes:

1 A list of thread descriptions is taken by reflecting the reflection pattern.

The description

g14(w1g7k7b2k2b2k2)b7

generates the thread counts:

g14w1g7k7b2k2b2k2b7k2b2k2b2k7g7w1g14

To give this tartan:

Abercrombie Tartan generated by mktartan


  1. The lowest number used is 1 although commonly the lowest threadcount used is 2 in order when weaving to get nice edges.
  2. In order to describe the simplest pattern of repeating the use of reflection is spelled out, whereas it could be assumed.

The original definition from C source code :

"The tartan is simply defined by the colours and numbers of threads that will appear in the",
"weave. Normally, you will only need to define half of the warp (the horizontal part of the",
"weave). This may be doubled by reflection, and the same pattern used for the weft or woof,",
"which is the vertical part of the weave. The following commands may be used in the .tdf file.",
"",
"#<6 digit hexadecimal number> <letter>",
"",
"Defines the colour known by <letter> to have a certain colour value, using the normal rrggbb",
"colour convention. The colour number must be exactly 6 digits long. Colours must be defined",
"before they are used. Example: '#ffc800 y' represents a yellow colour.",
"",
"r6(g10b10)k1",
"",
"states that the weave will contain 6 red threads followed by 10 green, 10 blue and 1 black",
"thread, provided that the appropriate colour have been defined. After these colours, the",
"section in brackets will be reversed and appended to the weave. There may only be one pair",
"of brackets in a pattern line.",
"",
"If a file contains one pattern line, the pattern will be used for both the warp and the weft.",
"Two pattern lines will generate separate warp and weft patterns. More lines is an error. All",
"tartans only require a single pattern line since they are the same in both directions. However",
"many tweeds do require two lines, because they are not symmetrical in this way.",
"",
"Example Tartan: 'Mar District'",
"",
"#ffc800 y",
"#000000 k",
"#c80000 r",
"#004c00 g",
"",
"(y1k4g32k4r1)",
"",
"Example Tweed: 'Kincardine Estate Tweed'",
"",
"#0000c8 b",
"#00c800 g",
"#c80000 r",
"#b9860b n",
"#8b4513 o",
"",
"b1(b1n15r1n14)n1",
"g1(g1o15r1o14)o1",

Return to blog