4

In latex chessboard package, by default, black squares are rendered with hatch patten. I want them in solid gray. enter image description here My several attempts failed, chessboard.pdf is not helpful here. The programming model is not clear, so I gave up. Need help. Thanks in advance.

\documentclass[preview]{standalone}
\usepackage[LSB,LSBC3,T1]{fontenc}
\usepackage{tikz}
\usepackage[skaknew]{skak,chessboard}
\begin{document}
\setchessboard{showmover=false}
\chessboard
\end{document}

2 Answers 2

7
\documentclass[preview]{standalone}
\usepackage[LSB,LSBC4,T1]{fontenc}
\usepackage{tikz}
\usepackage[skaknew]{skak,chessboard}
\begin{document}
    \setboardfontcolors{
        blackfieldmask=gray!30}
\setchessboard{boardfontencoding=LSBC4,setfontcolors,showmover=false}
\chessboard
\end{document}

Code with light gray. See setboardfontcolors.

Result

3
  • 1
    Thanks! Difficult getting through the documentation. +1
    – DJP
    Commented Sep 10, 2019 at 15:58
  • 1
    Life is cool because of you guys at StackExchange, a million thanks.
    – userOne
    Commented Sep 11, 2019 at 7:29
  • I will accept this as answer. It gives control over color. Also thanks to DJP for giving a quick solution.
    – userOne
    Commented Sep 11, 2019 at 7:43
5

The documentation on CTAN is here. I found something like what you wanted on page 34. I modified your code using boardfontencoding=LSBC4 to get the result below.

\documentclass[preview]{standalone}
\usepackage[LSB,LSBC4,T1]{fontenc}
\usepackage{tikz}
\usepackage[skaknew]{skak,chessboard}
\begin{document}
\setchessboard{boardfontencoding=LSBC4,setfontcolors,showmover=false}
\chessboard
\end{document}

enter image description here

3
  • The solution works, but can I set a lighter shade of gray? Say gray!30.
    – userOne
    Commented Sep 10, 2019 at 15:27
  • I tested color properties from the documentation and ran into transparency issues, and gave up. Strange, a font change is producing a different color.
    – userOne
    Commented Sep 10, 2019 at 15:38
  • Sango found the fix to modify the gray color and posted it in their answer.
    – DJP
    Commented Sep 10, 2019 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .