3

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}
5
\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

  • 1
    Thanks! Difficult getting through the documentation. +1 – DJP Sep 10 '19 at 15:58
  • Life is cool because of you guys at StackExchange, a million thanks. – userOne Sep 11 '19 at 7:29
  • I will accept this as answer. It gives control over color. Also thanks to DJP for giving a quick solution. – userOne Sep 11 '19 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

  • The solution works, but can I set a lighter shade of gray? Say gray!30. – userOne Sep 10 '19 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 Sep 10 '19 at 15:38
  • Sango found the fix to modify the gray color and posted it in their answer. – DJP Sep 10 '19 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.