[Tex/LaTex] Glenn fncychap + color of the box

colorfncychap

I'm using fncychap Glenn and I would like to have the chaptername, chapternumber as well as the title in the same color and only the box should have another color.

It tried with:

\documentclass[a4paper,11pt,twoside,fleqn,parskip=half,chapterprefix]{scrbook}
\usepackage{xcolor}
\usepackage[Glenn]{fncychap}
  \ChTitleVar{\bfseries\Large\rm\selectfont\scshape\color{blue}}
    \ChNumVar{\Huge\selectfont\color{blue}}
    \ChNameVar{\bfseries\Large\sf\selectfont\color{blue}}
\begin{document}
\chapter{Hello World!}
xbxbxbxbxbxbxbx
\end{document}

but the \ChNumVar changes the color of the box AND of the chapternumber…

I have tried:
\ChRuleWidth{1pt\selectfont\color{red}}, but this changed the color of the main text in document.

Any idea, how to change the color only of the box?

PS: my document class is scrbook and I use the package xcolor.

Best!

Best Answer

Do not use the old font commands like \rm and \sf! Since KOMA-Script version 3.20 you will get error messages.

You could patch the fncychap commands \DOCH, \DOTI and \DOTIS to use a different color for the rules:

\documentclass[fleqn,parskip=half,chapterprefix]{scrbook}
\usepackage[english]{babel}
\usepackage{blindtext}% only for dummy text

\usepackage{xcolor}
\usepackage[Glenn]{fncychap}
  \ChTitleVar{\bfseries\Large\rmfamily\scshape\color{blue}}
  \ChNumVar{\Huge\selectfont\color{blue}}
  \ChNameVar{\bfseries\Large\sffamily\color{blue}}
\usepackage{xpatch}
\xpatchcmd\DOCH
  {\mghrulefill}{\color{red}\mghrulefill}
  {}{\PatchFailed}
\xpatchcmd\DOTI
  {\mghrulefill}{\color{red}\mghrulefill}
  {}{\PatchFailed}
\xpatchcmd\DOTIS
  {\mghrulefill}{\color{red}\mghrulefill}
  {}{\PatchFailed}

\begin{document}
\tableofcontents
\blinddocument
\end{document}

enter image description here

enter image description here

Related Question