如何创建这样的颜色框?

如何创建这样的颜色框?

在此处输入图片描述

我正在尝试制作像上面这样的 tcolorbox,但我不知道正确的方法是什么......

可以将 tcolorbox 做成这样吗?(ABC 可以位于中心...)?

我尝试了几次,但我真的不知道怎么做(我想把图像作为水印,但是图像被裁剪了或者其他什么...)

在此处输入图片描述

答案1

像这样?

\documentclass[tikz,margin=5mm]{standalone}
\usepackage[most]{tcolorbox}
\tcbset
    {
        enhanced,
        left=8mm,
        right=8mm,
        boxrule=0.4pt,
        colback=red!5!white,
        boxrule=1pt,
        colframe=red!75!black,fonttitle=\bfseries,
        width=(\linewidth-4pt)/2,
    }
\begin{document}
\begin{tikzpicture}[]
    \node[anchor=south west,inner sep=0] at (0,0)(pic) {\includegraphics[width=\textwidth]{example-image}};
    \draw [ultra thick,red](current bounding box.north east) rectangle (current bounding box.south west);
    \node at ([yshift=-2.5cm] pic.center)
    {\begin{tcolorbox}
    \centering ABC
    \end{tcolorbox}};
\end{tikzpicture}
\end{document}

在此处输入图片描述

赋予一些不透明度tcolorbox

\documentclass[tikz,margin=5mm]{standalone}
\usepackage[most]{tcolorbox}
\tcbset
    {
        enhanced,
        left=8mm,
        right=8mm,
        boxrule=0.4pt,
        colback=red!5!white,
        boxrule=1pt,
        colframe=red!75!black,fonttitle=\bfseries,
        width=(\linewidth-4pt)/2,
         }
\begin{document}
\begin{tikzpicture}[]
    \node[anchor=south west,inner sep=0] at (0,0)(pic) {\includegraphics[width=\textwidth]{example-image}};
    \draw [ultra thick,red](current bounding box.north east) rectangle (current bounding box.south west);
    \node[] at ([yshift=-1.25cm] pic.center)
    {\begin{tcolorbox}[
    standard jigsaw,
    opacityback=0.2,  % this works only in combination with the key "standard jigsaw"
]
    \centering ABC
    \end{tcolorbox}};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容