I am using the titlesec package to format the titles of sections. I would like to change the background color of the frame shape.
Concretely, I would like to obtain a solid (that is, the same color for the frame and background) blue frame and white text.
I tried the naive approach of using \colorbox as a format in\titleformat but it does not seem to work:
\documentclass{article}
\usepackage{xcolor}
\usepackage{titlesec}
\setcounter{secnumdepth}{0}
\newcommand{\mybox}[1]{
\colorbox{blue}{\textcolor{white}{#1}}
}
\titleformat{\section}
[frame]
{
\vspace{.8ex}%
\color{blue}\Large\normalfont\sffamily\mybox
}
{\thesection.}
{.5em}
{}
\begin{document}
\section{First section}
The first section begins here\ldots
\section{Second section}
The second section begins here\ldots
\end{document}
I would be very grateful if someone could explain how I can obtain the desired result.

blockstyle, and as last argument,{\colorbox{RoyalBlue!80}{\parbox{\textwidth}{\centering\strut #1\vskip 0.5ex}}}. On the other hand, theframeis fard-coded in tha package, and I don't see how to patch it to obtain a coloured background. – Bernard Dec 03 '19 at 11:56