[Tex/LaTex] Create a color box

fancyboxtcolorbox

anyone can help me with latex code how to create a box as the following figures?
enter image description here

the second box is

enter image description here

I tried to use package{tcolorbox}, but not succeed. I would like to create a box exactly as in figure 1 with that color! I would like to automatically numbering "Assumption SLR. xx" in figure 1 as well as in figure 2 with "Example 1.xxx"

Thanks

Best Answer

Improved version:

\documentclass{article}
\usepackage[many]{tcolorbox}
\usetikzlibrary{calc}

\definecolor{myblue}{RGB}{0,163,243}

\tcbset{mystyle/.style={
  breakable,
  enhanced,
  outer arc=0pt,
  arc=0pt,
  colframe=myblue,
  colback=myblue!20,
  attach boxed title to top left,
  boxed title style={
    colback=myblue,
    outer arc=0pt,
    arc=0pt,
    top=3pt,
    bottom=3pt,
    },
  fonttitle=\sffamily
  }
}

\newtcolorbox[auto counter,number within=section]{example}[1][]{
  mystyle,
  title=Example~\thetcbcounter,
  overlay unbroken and first={
      \path
        let
        \p1=(title.north east),
        \p2=(frame.north east)
        in
        node[anchor=west,font=\sffamily,color=myblue,text width=\x2-\x1] 
        at (title.east) {#1};
  }
}
\newtcolorbox[auto counter]{assumption}[1][]{
  mystyle,
  colback=white,
  rightrule=0pt,
  toprule=0pt,
  title=Assumption SLR.\thetcbcounter,
  overlay unbroken and first={
      \path
        let
        \p1=(title.north east),
        \p2=(frame.north east)
        in
        node[anchor=west,font=\sffamily,color=myblue,text width=\x2-\x1] 
        at (title.east) {#1};
  }
}

\begin{document}

\section{Test section}
\begin{example}
test
\end{example}
\begin{assumption}
test
\end{assumption}
\begin{example}[Optional title]
test
\end{example}
\begin{assumption}[Optional title with some more words for the example so it spans two lines]
test
\end{assumption}

\end{document}

The result:

enter image description here

First version:

One possibility:

\documentclass{article}
\usepackage[many]{tcolorbox}

\definecolor{myblue}{RGB}{0,163,243}

\tcbset{mystyle/.style={
  breakable,
  enhanced,
  outer arc=0pt,
  arc=0pt,
  colframe=myblue,
  colback=myblue!20,
  attach boxed title to top left,
  boxed title style={
    colback=myblue,
    outer arc=0pt,
    arc=0pt,
    },
  title=Example~\thetcbcounter,
  fonttitle=\sffamily
  }
}

\newtcolorbox[auto counter,number within=section]{example}[1][]{
  mystyle,
  title=Example~\thetcbcounter,
  }
\newtcolorbox[auto counter]{assumption}[1][]{
  mystyle,
  title=Assumption SLR.\thetcbcounter,
  }

\begin{document}

\section{Test section}
\begin{example}
test
\end{example}
\begin{assumption}
test
\end{assumption}

\end{document}

The output:

enter image description here

I used the same style for both examples and assumptions, but if you also want to reproduce the other style, a simple modification will do:

\documentclass{article}
\usepackage[many]{tcolorbox}

\definecolor{myblue}{RGB}{0,163,243}

\tcbset{mystyle/.style={
  breakable,
  enhanced,
  outer arc=0pt,
  arc=0pt,
  colframe=myblue,
  colback=myblue!20,
  attach boxed title to top left,
  boxed title style={
    colback=myblue,
    outer arc=0pt,
    arc=0pt,
    },
  title=Example~\thetcbcounter,
  fonttitle=\sffamily
  }
}

\newtcolorbox[auto counter,number within=section]{example}[1][]{
  mystyle,
  title=Example~\thetcbcounter,
  }
\newtcolorbox[auto counter]{assumption}[1][]{
  mystyle,
  colback=white,
  rightrule=0pt,
  toprule=0pt,
  title=Assumption SLR.\thetcbcounter,
  }

\begin{document}

\section{Test section}
\begin{example}
test
\end{example}
\begin{assumption}
test
\end{assumption}

\end{document}

The output:

enter image description here