# Adding background color to active sections of beamer sidebar

I have designed a theme for my beamer presentation which has sidebar in it. Now I want to add background color for active items in the sidebar. How can I do that?

Following picture shows what I intend to do.

Since you are not providing a MWE I'm using a standard sidebar theme to show what you need to do in principle. If you need something more specific for your use case please provide a MWE with your code.

\documentclass{beamer}
\usepackage{tikz}
\usetheme{Hannover}

\begin{document}
\section{first}
\begin{frame}
this is a test
\end{frame}
\section{second}
\begin{frame}
this is a test 2
\end{frame}
\end{document}


You can customize the appearance as much as you like by styling the TikZ node.

If you also want sections to be highlighted when there are subsections (by default Beamer shades a section when it has subsections), you need to add the following code to your preamble (kindly provided by @diabonas)

\usepackage{etoolbox}
\makeatletter