Template talk:Chess pos2

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Instructions for Use of Template:Chess pos2[edit]

The chess board created here is in BROWN colour (html colour dc8c2f for dark fields and ffffcc for light fields) with a corresponding brown frame. The board has letters/numbers on all sides. The size of the board may be increased/decreased.

When inserting the diagrams, you have the option of specifying

  • the position of the board (left or right) (center I have not tried)
  • using frame or no frame
  • whether text should be shown to the right (left) of the diagram (or avoided).
  • thumb text or no text

This method is used in chess-articles on the Danish wikipedia in order to obtain a uniform look throughout the many articles. Examples could be seen here: da:pat or da:opposition (skak).

To use this method requires

  • that you have the template Chess-pos2 available on your wikipedia
  • that you use the pictures of fields and pieces as uploaded to Commons or create the fields yourself. The pictures on commons can be found here: [[1]]
  • that you specify the position on the board as described below

Instructions for adaption of the board and the optional features are given in the following.

You will also find instruction on how to change to another colour scheme, if you have a better idea for colours. Please note, that I am not an expert in colours and have just chosen a combination that “looked good” and had sufficient contrast to show the pieces.

Inserting a chess-diagram in an article[edit]

Inserting the following code in your article will produce an empty board:

<div class="tright" style="margin-bottom: 0.3em; margin-left:15px; width: 225px; border:2px solid #cccccc; padding: 10px !important; font-size: 94%; text-align: center;">

 8 |  |  |  |  |  |  |  |  |=
 7 |  |  |  |  |  |  |  |  |=
 6 |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |  |  |  |  |=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |  |  |  |  |  |  |  |  |=
 1 |  |  |  |  |  |  |  |  |=
    a  b  c  d  e  f  g  h

<div style="border: none; text-align: left; font-size: 94%; line-height: 1.4; padding: 0.3em 0 0.1em 0">
(Insert caption here)</div></div></div>

Specifying position[edit]

The position is specified by entering a two-letter code in the spaces after

{{Chess pos2|=

The spaces shows the individual fields of the board, of course. Fields without pieces are left blank.

The two-letter code consists of the following:

The first letter is (with the exception for knight and a field with a red cross) the first letter of the name of the piece in English. I.e.

  • k for king
  • q for queen
  • r for rook
  • b for bishop
  • n for knight
  • p for pawn

The second letter is

  • d for “black” (dark) piece
  • l for “white” (light) piece

A field with a red cross (i.e. to show the move of a piece) is simply indicated by an “x”.


A full board showing the starting position is inserted with this code:

<div class="right" style="margin-bottom: 0.3em; margin-left:15px; width: 225px; padding: 10px !important; font-size: 94%; text-align: center;">
{{Chess pos2|=

 8 |rd|nd|bd|qd|kd|bd|nd|rd|=
 7 |pd|pd|pd|pd|pd|pd|pd|pd|=
 6 |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |  |  |  |  |=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |pl|pl|pl|pl|pl|pl|pl|pl|=
 1 |rl|nl|bl|ql|kl|bl|nl|rl|=
    a  b  c  d  e  f  g  h

<div style="border: none; text-align: center; font-size: 94%; line-height: 1.4; padding: 0.3em 0 0.1em 0">
Board with start position of chess</div></div></div>



The border may be removed by removing the instruction:

border:2px solid #cccccc;

Position of diagram and text[edit]

class= “tright” positions the diagram to the rigth with text to the left and may be substituted as follows:

  • The diagram to the left with text to the right: class=”tleft” (you should remove also margin-left:15px; from style to obtain correct left margin)
  • The diagram to the left without text to the right: class=”left”

Note: a diagram to the right with a little or no text to the left: Insert the html code

<br style="clear:right"/>

after (or instead of) the text.

Size of board[edit]

The size of the board is controlled by the number preceding }} – (here 23) and the parameter width. If you change the size 23, you must adapt the width at the same time. Maximum size is 40 and less than 18 should be avoided. Please note also, that sizes less than 30 "break up" if users change their view-settings for the internet browser to the largest text size.


  • width:185px corresponds to 18
  • width:225px corresponds to 23 (as above)
  • width:330px corresponds to 35


The caption may be omitted by removing the last part of the code, namely this:

<div style="border: none; text-align: left; font-size: 94%; line-height: 1.4; padding: 0.3em 0 0.1em 0"> (Insert thumb here)</div></div></div>

You may change the text alignment to "center" or "right" according to your wishes, of course.

Other tiles, i.e with arrows[edit]

You may download the light and dark "space"-tiles and modify them according to your wishes. Then upload them to Commons, making sure that they fit the naming conventions of the template. Then they can be used immediately by entering the two-letter code you assign to them.

Board in different colour[edit]

To create a board in a different colour would take about an hour or so. What needs to be done is to

  • take each piece (field) shown in template:Chess_tiles_brown and change its background colour (using the open source software (OSS) ´´ GIMP´´, for example)
  • name the pieces according to the convention of the template chess-pos2 and upload them to Commons – or your wiki
  • change the border of template chess-pos2 to correspond to your new background.

Combining English and Danish solution[edit]

It is also possible to use the English template w:Template:Chess position together with the brown tiles. Editing the English template and changing the image names from Image:Chess_xxxx to Image:Chs2_xxxx should do the trick (except for the tiles with red cross - they should be renamed to fit the English naming convention).

End of instruction. --Sir48 22:34, 17 Jun 2005 (UTC) (Sir48-DK, profile in English)

Start of


PNG supports transparency! Hence, all we need are 12 transparent tiles (1 for each piece of each color). Then the chess board template simply sets the background color for each square. I've done this. See Image:Chess tile pd.png for more information. dbenbenn | talk 18:21, 18 Jun 2005 (UTC)