[Tex/LaTex] \begin{framed} with background-color

framed

Does anybody know how to set the background-color of a framed element?

\begin{framed}       
    Let me have a background :( 
\end{framed}

Best Answer

Using the mdframed package defining the background colour is pretty easy:

\documentclass{article}
\usepackage{xcolor}
\usepackage{mdframed}

\begin{document}

    test

    \begin{mdframed}[backgroundcolor=blue!20] 
        In any right triangle, the area of the square whose side is the hypotenuse is equal to the sum of the areas of the squares whose sides are the two legs.
    \end{mdframed}

\end{document}

enter image description here