This is a documentation for Board Game Arena: play board games online !
Template:Chessboard: Difference between revisions
Jump to navigation
Jump to search
Sammy McSam (talk | contribs) m (added draughts example) |
Sammy McSam (talk | contribs) (added gridline variables & othello example) |
||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
== Basic | == Basic <nowiki>{{chessboard}}</nowiki> template == | ||
</noinclude> | </noinclude> | ||
<div style="display:grid;grid:{{{hideNotation|1.5rem}}} repeat(8,{{{squareSize|46}}}px) {{{hideNotation|1.5rem}}} / {{{hideNotation|1.5rem}}} repeat(8, {{{squareSize|46}}}px) {{{hideNotation|1.5rem}}};width:calc({{{hideNotation|3rem + }}}8 * {{{squareSize|46}}}px);height:calc({{{hideNotation|3rem + }}}8 * {{{squareSize|46}}}px);">{{{hideNotation| | <div style="display:grid;grid:{{{hideNotation|1.5rem}}} repeat(8,{{{squareSize|46}}}px) {{{hideNotation|1.5rem}}} / {{{hideNotation|1.5rem}}} repeat(8,{{{squareSize|46}}}px) {{{hideNotation|1.5rem}}};gap:{{{gridlineThickness|0}}}px;width:calc({{{hideNotation|3rem + }}}8 * ({{{squareSize|46}}}px + {{{gridlineThickness|0}}}px) + {{{gridlineThickness|0}}}px);height:calc({{{hideNotation|3rem + }}}8 * ({{{squareSize|46}}}px + {{{gridlineThickness|0}}}px) + {{{gridlineThickness|0}}}px);position:relative;"> | ||
<div class="board background" style="position:absolute;background:{{{gridColour|}}};z-index:-1;left:calc(2 * -{{{gridlineThickness|0}}}px);top:calc(2 * -{{{gridlineThickness|0}}}px);width:calc(100% + 4 * {{{gridlineThickness|0}}}px);height:calc(100% + 4 * {{{gridlineThickness|0}}}px);grid-area:calc({{{hideNotation|1 + }}}1) / calc({{{hideNotation|1 + }}}1) / calc(-1{{{hideNotation| - 1}}}) / calc(-1{{{hideNotation| - 1}}});border-radius:calc({{{cornerRadius|8}}}px + 2 * {{{gridlineThickness|0}}}px);"></div>{{{hideNotation| | |||
<div></div> | <div></div> | ||
<div style="align-self:end;text-align:center;">A</div> | <div style="align-self:end;text-align:center;">A</div> | ||
Line 49: | Line 50: | ||
</div> | </div> | ||
</div> | </div> | ||
<div style="display:grid;background:{{{darkSquareColour|#ddd}}};border-top:solid {{{borderThickness|2}}}px {{{darkSquareColour|#ddd}}};border-right:solid | <div style="display:grid;background:{{{darkSquareColour|#ddd}}};border-top:solid {{{borderThickness|2}}}px {{{darkSquareColour|#ddd}}};border-right:solid {{{borderThickness|2}}}px {{{darkSquareColour|#ddd}}};border-top-right-radius:{{{cornerRadius|8}}}px;"> | ||
<div style="display:grid;place-items:center;position:relative;background:{{{highlighth8|}}};"> | <div style="display:grid;place-items:center;position:relative;background:{{{highlighth8|}}};"> | ||
<div style="position:absolute;">{{{h8|{{emptySquare}}}}}</div> | <div style="position:absolute;">{{{h8|{{emptySquare}}}}}</div> | ||
Line 358: | Line 359: | ||
e.g. https://boardgamearena.com/gamepanel?game=chess under HOW TO PLAY? > See More > RULES SUMMARY | e.g. https://boardgamearena.com/gamepanel?game=chess under HOW TO PLAY? > See More > RULES SUMMARY | ||
Empty board template | === Empty board template === | ||
<pre> | <pre> | ||
{{chessboard | {{chessboard | ||
Line 371: | Line 372: | ||
}} | }} | ||
</pre> | </pre> | ||
=== Available parameters === | |||
<div style="display:grid;grid-template-columns:minmax(min-content,max-content);gap:1.5rem;overflow:hidden;text-overflow:ellipsis;"> | <div style="display:grid;grid-template-columns:minmax(min-content,max-content);gap:1.5rem;overflow:hidden;text-overflow:ellipsis;"> | ||
<div style="display:flex;flex-flow:row wrap;gap:0.5rem;"> | <div style="display:flex;flex-flow:row wrap;gap:0.5rem;"> | ||
Line 425: | Line 429: | ||
<div style="border-top:0.2rem solid green ;border-left:0.15rem solid green ;border-radius:0.5rem 0.5rem 0 0;"><code><nowiki>{{chessboard | hideNotation=}}</nowiki></code></div> | <div style="border-top:0.2rem solid green ;border-left:0.15rem solid green ;border-radius:0.5rem 0.5rem 0 0;"><code><nowiki>{{chessboard | hideNotation=}}</nowiki></code></div> | ||
<div style="border-top:0.2rem solid cyan ;border-left:0.15rem solid cyan ;border-radius:0.5rem 0.5rem 0 0;padding-left:0.2rem;"><b><i>Optional:</i></b> hide algebraic notation</div> | <div style="border-top:0.2rem solid cyan ;border-left:0.15rem solid cyan ;border-radius:0.5rem 0.5rem 0 0;padding-left:0.2rem;"><b><i>Optional:</i></b> hide algebraic notation</div> | ||
</div> | |||
<div style="display:flex;flex-flow:row wrap;gap:0.5rem;"> | |||
<div style="border-top:0.2rem solid red ;border-left:0.15rem solid red ;border-radius:0.5rem 0.5rem 0 0;"><code>gridlineThickness</code></div> | |||
<div style="border-top:0.2rem solid orange;border-left:0.15rem solid orange;border-radius:0.5rem 0.5rem 0 0;"><code>0</code></div> | |||
<div style="border-top:0.2rem solid green ;border-left:0.15rem solid green ;border-radius:0.5rem 0.5rem 0 0;"><code><nowiki>{{chessboard | gridlineThickness=2}}</nowiki></code></div> | |||
<div style="border-top:0.2rem solid cyan ;border-left:0.15rem solid cyan ;border-radius:0.5rem 0.5rem 0 0;padding-left:0.2rem;"><b><i>Optional:</i></b> specify the gridline thickness in px units</div> | |||
</div> | |||
<div style="display:flex;flex-flow:row wrap;gap:0.5rem;"> | |||
<div style="border-top:0.2rem solid red ;border-left:0.15rem solid red ;border-radius:0.5rem 0.5rem 0 0;"><code>gridColour</code></div> | |||
<div style="border-top:0.2rem solid orange;border-left:0.15rem solid orange;border-radius:0.5rem 0.5rem 0 0;"><code>null</code></div> | |||
<div style="border-top:0.2rem solid green ;border-left:0.15rem solid green ;border-radius:0.5rem 0.5rem 0 0;"><code><nowiki>{{chessboard | gridColour=black}}</nowiki></code></div> | |||
<div style="border-top:0.2rem solid cyan ;border-left:0.15rem solid cyan ;border-radius:0.5rem 0.5rem 0 0;padding-left:0.2rem;"><b><i>Optional:</i></b> specify the grid colour as <code><b>[string]</b></code> where <code><b>[string]</b></code> is any valid <code>style="background:<b>[string]</b>;"</div> | |||
</div> | </div> | ||
</div> | </div> | ||
== Chess | |||
== Examples == | |||
=== Chess === | |||
{{chessboard | lightSquareColour=#efe | darkSquareColour=#cdc | {{chessboard | lightSquareColour=#efe | darkSquareColour=#cdc | ||
Line 451: | Line 470: | ||
}} | }} | ||
</pre> | </pre> | ||
== Draughts / Checkers | |||
=== Draughts / Checkers === | |||
<div style="display:flex; flex-flow:row wrap; gap:0.5rem;"> | <div style="display:flex; flex-flow:row wrap; gap:0.5rem;"> | ||
{{chessboard | hideNotation= | squareSize=50 | lightSquareColour=#eed | darkSquareColour=#5a5 | {{chessboard | hideNotation= | squareSize=50 | lightSquareColour=#eed | darkSquareColour=#5a5 | ||
Line 549: | Line 570: | ||
| f2={{blackDraughtsKing}} | | f2={{blackDraughtsKing}} | ||
}} | |||
</div> | |||
</pre> | |||
=== Othello / Reversi === | |||
<div style="display:flex; flex-flow:row wrap; gap:0.25rem;"> | |||
{{chessboard | hideNotation= | squareSize=54 | lightSquareColour=darkgreen | darkSquareColour=darkgreen | cornerRadius=4 | gridlineThickness=2 | gridColour=black | |||
| highlightc5=rgba(255,255,255,0.25) | |||
| highlightd6=rgba(255,255,255,0.25) | |||
| highlighte3=rgba(255,255,255,0.25) | |||
| highlightf4=rgba(255,255,255,0.25) | |||
| d4={{blackReversiToken}} | |||
| e5={{blackReversiToken}} | |||
| e4={{whiteReversiToken}} | |||
| d5={{whiteReversiToken}} | |||
}} | |||
{{chessboard | hideNotation= | squareSize=54 | lightSquareColour=darkgreen | darkSquareColour=darkgreen | cornerRadius=4 | gridlineThickness=2 | gridColour=black | |||
| d4={{blackReversiToken}} | |||
| e5={{blackReversiToken}} | |||
| e4={{blackReversiToken}} | |||
| f4={{blackReversiToken}} | |||
| d5={{whiteReversiToken}} | |||
}} | |||
{{chessboard | hideNotation= | squareSize=54 | lightSquareColour=darkgreen | darkSquareColour=darkgreen | cornerRadius=4 | gridlineThickness=2 | gridColour=black | |||
| highlightc5=rgba(255,255,255,0.25) | |||
| highlightd6=rgba(255,255,255,0.25) | |||
| highlighte3=rgba(255,255,255,0.25) | |||
| highlightf2=rgba(255,255,255,0.25) | |||
| d4={{blackReversiToken}} | |||
| e5={{blackReversiToken}} | |||
| f4={{blackReversiToken}} | |||
| d5={{whiteReversiToken}} | |||
| e4={{whiteReversiToken}} | |||
| f3={{whiteReversiToken}} | |||
}} | |||
</div> | |||
<pre> | |||
<div style="display:flex; flex-flow:row wrap; gap:0.25rem;"> | |||
{{chessboard | hideNotation= | squareSize=54 | lightSquareColour=darkgreen | darkSquareColour=darkgreen | cornerRadius=4 | gridlineThickness=2 | gridColour=black | |||
| highlightc5=rgba(255,255,255,0.25) | |||
| highlightd6=rgba(255,255,255,0.25) | |||
| highlighte3=rgba(255,255,255,0.25) | |||
| highlightf4=rgba(255,255,255,0.25) | |||
| d4={{blackReversiToken}} | |||
| e5={{blackReversiToken}} | |||
| e4={{whiteReversiToken}} | |||
| d5={{whiteReversiToken}} | |||
}} | |||
{{chessboard | hideNotation= | squareSize=54 | lightSquareColour=darkgreen | darkSquareColour=darkgreen | cornerRadius=4 | gridlineThickness=2 | gridColour=black | |||
| d4={{blackReversiToken}} | |||
| e5={{blackReversiToken}} | |||
| e4={{blackReversiToken}} | |||
| f4={{blackReversiToken}} | |||
| d5={{whiteReversiToken}} | |||
}} | |||
{{chessboard | hideNotation= | squareSize=54 | lightSquareColour=darkgreen | darkSquareColour=darkgreen | cornerRadius=4 | gridlineThickness=2 | gridColour=black | |||
| highlightc5=rgba(255,255,255,0.25) | |||
| highlightd6=rgba(255,255,255,0.25) | |||
| highlighte3=rgba(255,255,255,0.25) | |||
| highlightf2=rgba(255,255,255,0.25) | |||
| d4={{blackReversiToken}} | |||
| e5={{blackReversiToken}} | |||
| f4={{blackReversiToken}} | |||
| d5={{whiteReversiToken}} | |||
| e4={{whiteReversiToken}} | |||
| f3={{whiteReversiToken}} | |||
}} | }} | ||
</div> | </div> | ||
</pre> | </pre> | ||
</noinclude> | </noinclude> |
Revision as of 14:26, 16 December 2021
Basic {{chessboard}} template
To insert this chessboard template into a BGA wiki page, simply type {{chessboard}}
when editing the page, or alternatively copy one of the examples below.
Note: Game Help pages (e.g. 'GameHelpChess') also display on BGA's Rules Summary pages e.g. https://boardgamearena.com/gamepanel?game=chess under HOW TO PLAY? > See More > RULES SUMMARY
Empty board template
{{chessboard | a8= | b8= | c8= | d8= | e8= | f8= | g8= | h8= | a7= | b7= | c7= | d7= | e7= | f7= | g7= | h7= | a6= | b6= | c6= | d6= | e6= | f6= | g6= | h6= | a5= | b5= | c5= | d5= | e5= | f5= | g5= | h5= | a4= | b4= | c4= | d4= | e4= | f4= | g4= | h4= | a3= | b3= | c3= | d3= | e3= | f3= | g3= | h3= | a2= | b2= | c2= | d2= | e2= | f2= | g2= | h2= | a1= | b1= | c1= | d1= | e1= | f1= | g1= | h1= }}
Available parameters
Examples
Chess
{{chessboard | lightSquareColour=#efe | darkSquareColour=#cdc
| a8={{blackRook}} | b8={{blackKnight}}| c8={{blackBishop}}| d8={{blackQueen}} | e8={{blackKing}} | f8={{blackBishop}}| g8={{blackKnight}}| h8={{blackRook}}
| a7={{blackPawn}} | b7={{blackPawn}} | c7={{blackPawn}} | d7={{blackPawn}} | e7={{blackPawn}} | f7={{blackPawn}} | g7={{blackPawn}} | h7={{blackPawn}}
| a6= | b6= | c6= | d6= | e6= | f6= | g6= | h6=
| a5= | b5= | c5= | d5= | e5= | f5= | g5= | h5=
| a4= | b4= | c4= | d4= | e4= | f4= | g4= | h4=
| a3= | b3= | c3= | d3= | e3= | f3= | g3= | h3=
| a2={{whitePawn}} | b2={{whitePawn}} | c2={{whitePawn}} | d2={{whitePawn}} | e2={{whitePawn}} | f2={{whitePawn}} | g2={{whitePawn}} | h2={{whitePawn}}
| a1={{whiteRook}} | b1={{whiteKnight}}| c1={{whiteBishop}}| d1={{whiteQueen}} | e1={{whiteKing}} | f1={{whiteBishop}}| g1={{whiteKnight}}| h1={{whiteRook}}
}}
Draughts / Checkers
<div style="display:flex; flex-flow:row wrap; gap:0.5rem;">
{{chessboard | hideNotation= | squareSize=50 | lightSquareColour=#eed | darkSquareColour=#5a5
| d8={{whiteDraughtsKing}}
| highlightd8=gold
| highlightc7=blue
| highlighte7=blue
| b4={{whiteDraughtsMan}}
| f4={{whiteDraughtsMan}}
| c3={{whiteDraughtsMan}}
| b6={{blackDraughtsMan}}
| d6={{blackDraughtsMan}}
| e1={{blackDraughtsKing}}
}}
{{chessboard | hideNotation= | squareSize=50 | lightSquareColour=#eed | darkSquareColour=#5a5
| e7={{whiteDraughtsKing}}
| highlighte7=gold
| highlightd6=red
| highlightc5=blue
| highlightb6=red
| highlighta7=blue
| b4={{whiteDraughtsMan}}
| f4={{whiteDraughtsMan}}
| c3={{whiteDraughtsMan}}
| b6={{blackDraughtsMan}}
| d6={{blackDraughtsMan}}
| f2={{blackDraughtsKing}}
}}
{{chessboard | hideNotation= | squareSize=50 | lightSquareColour=#eed | darkSquareColour=#5a5
| a7={{whiteDraughtsKing}}
| highlighte7=gold
| highlightd6=red
| highlightc5=blue
| highlightb6=red
| highlighta7=blue
| b4={{whiteDraughtsMan}}
| f4={{whiteDraughtsMan}}
| c3={{whiteDraughtsMan}}
| f2={{blackDraughtsKing}}
}}
</div>
Othello / Reversi
<div style="display:flex; flex-flow:row wrap; gap:0.25rem;">
{{chessboard | hideNotation= | squareSize=54 | lightSquareColour=darkgreen | darkSquareColour=darkgreen | cornerRadius=4 | gridlineThickness=2 | gridColour=black
| highlightc5=rgba(255,255,255,0.25)
| highlightd6=rgba(255,255,255,0.25)
| highlighte3=rgba(255,255,255,0.25)
| highlightf4=rgba(255,255,255,0.25)
| d4={{blackReversiToken}}
| e5={{blackReversiToken}}
| e4={{whiteReversiToken}}
| d5={{whiteReversiToken}}
}}
{{chessboard | hideNotation= | squareSize=54 | lightSquareColour=darkgreen | darkSquareColour=darkgreen | cornerRadius=4 | gridlineThickness=2 | gridColour=black
| d4={{blackReversiToken}}
| e5={{blackReversiToken}}
| e4={{blackReversiToken}}
| f4={{blackReversiToken}}
| d5={{whiteReversiToken}}
}}
{{chessboard | hideNotation= | squareSize=54 | lightSquareColour=darkgreen | darkSquareColour=darkgreen | cornerRadius=4 | gridlineThickness=2 | gridColour=black
| highlightc5=rgba(255,255,255,0.25)
| highlightd6=rgba(255,255,255,0.25)
| highlighte3=rgba(255,255,255,0.25)
| highlightf2=rgba(255,255,255,0.25)
| d4={{blackReversiToken}}
| e5={{blackReversiToken}}
| f4={{blackReversiToken}}
| d5={{whiteReversiToken}}
| e4={{whiteReversiToken}}
| f3={{whiteReversiToken}}
}}
</div>