[Tex/LaTex] Box with fancy colors

boxes

Does anyone know how to create these?

enter image description here

enter image description here

I think they made it by using tcolorbox but I can't find a way to generate them.

Best Answer

One possibility:

enter image description here

The code:

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

\definecolor{bidentitlebg}{RGB}{158,59,255}

\newtcolorbox{ridentidad}[1][]{
  enhanced,
  frame code={
    \fill[draw=white,top color=white,bottom color=red!60]
      ([xshift=-20pt]title.north west) --
      (title.south west) --
      (title.south east) --
      ([xshift=20pt]title.north east) -- cycle;
    \draw[red,line width=0.4mm,rounded corners]
      (frame.north west) --
      (frame.south west) --
      ([xshift=-20pt]title.north west) --
      (title.south west) --
      (title.south east) --
      ([xshift=20pt]title.north east) --
      (frame.south east) --
      (frame.north east);
  },
  coltitle=red!70!black,
  colback=white,
  attach boxed title to bottom center,
  boxed title style={empty},
  fonttitle=\bfseries\sffamily,
  title=\strut Identidades,
  #1,
}

\newtcolorbox{bidentidad}[1][]{
  enhanced,
  skin=enhancedlast jigsaw,
  attach boxed title to top left={xshift=-4mm,yshift=-0.5mm},
  fonttitle=\bfseries\sffamily,
  colbacktitle=blue!45,
  colframe=red!50!black,
  interior style={
    top color=blue!10,
    bottom color=red!10
  },
  boxed title style={
    empty,
    arc=0pt,
    outer arc=0pt,
    boxrule=0pt
  },
  underlay boxed title={
    \fill[blue!45!white] 
      (title.north west) -- 
      (title.north east) -- 
      +(\tcboxedtitleheight-1mm,-\tcboxedtitleheight+1mm) -- 
      ([xshift=4mm,yshift=0.5mm]frame.north east) -- 
      +(0mm,-1mm) -- 
      (title.south west) -- cycle;
    \fill[blue!45!white!50!black] 
      ([yshift=-0.5mm]frame.north west) -- 
      +(-0.4,0) -- 
      +(0,-0.3) -- cycle;
    \fill[blue!45!white!50!black] 
      ([yshift=-0.5mm]frame.north east) -- 
      +(0,-0.3) -- 
      +(0.4,0) -- cycle; 
  },
  title={Identidades},
  #1
}

\begin{document}

\begin{ridentidad}
\lipsum[4]
\end{ridentidad}

\begin{bidentidad}
\lipsum[4]
\end{bidentidad}

\end{document}

The code for the second one was taken directly from page 133 of the tcolorbox manual.