[Tex/LaTex] How to place the chapter number behind the chapter title in KOMA script

chapterskoma-scriptsectioning

I have the following layout for my chapter title and number:
The current layout

I reached this using the following code:

\renewcommand*{\chapterformat}{%
  \fontsize{60}{68}\selectfont\color{Gray}\thechapter\autodot\enskip}

\addtokomafont{chapter}{%
  \renewcommand*{\raggedsection}{\raggedleft}}

What is the best way to move the chapter number (2 in this case) to the right end of the same line, so that it overlaps with the chapter title? (I want the title to be on top). If possible, I want the method to integrate well with KOMA script, for example by redefining \chapterformat like I did above.

Best Answer

You mean like this?

Overlapping title

That doesn't look good, does it?

At the very least, I would do something like this:

\renewcommand*{\chapterformat}{%
  \rlap{\makebox[\linewidth][r]{\colorbox{ltGray}{\fontsize{60}{68}\selectfont\color{Gray}\thechapter\autodot}}}}

\addtokomafont{chapter}{%
  \renewcommand*{\raggedsection}{\raggedleft\rightskip1.2em\hfill}}

Partially overlapping title

Disclaimer: I'm not a designer!