I want my subsection title to have a colored background with support for line breaks. There are a few questions about spanning that background to the margins - that's not what I want to achieve, however.
After some research I found that the soul package comes pretty close to what I need, but I can't, unfortunately, seem to use its \hl command in KOMA's \addtokomafont.
Here's an MWE
\documentclass[a5paper,pagesize]{scrbook}
\usepackage{xcolor,soul}
\sethlcolor{black}
\addtokomafont{subsection}{\hl\mdseries\color{red}}
\begin{document}
\subsection{A very peculiar title which will hopefully break into the next line}
\end{document}



\MakeUppercasein\addtokomafont(possibly related to this), though. Anyway, since I'm auto-generating the TeX code, I can uppercase the text before writing the .tex file. – hauptbenutzer Apr 28 '16 at 12:27\MakeUppercasein\addtokomafontor\setkomafont. You can change\sectionlinesformatinstead. See my updated answer. – esdd Apr 28 '16 at 12:50