Tcolorbox、titlerule 或附加框式标题破坏了标题的透明度

Tcolorbox、titlerule 或附加框式标题破坏了标题的透明度

基于这个答案我尝试过买透明的tcolorbox,但我想买一个titlerule

在此处输入图片描述

我注意到当我添加行时

  • 上盒不透明,attach boxed title to top left
  • 出现完整的框titlerule style={red,arrows = {Hooks[arc=270]-Hooks[arc=270]}} ]

在此处输入图片描述

在此处输入图片描述

肯定是有原因的,而我确实忽略了一些东西。

平均能量损失

\documentclass[tikz]{article}
\usepackage{xcolor}
\usepackage{pagecolor}
\pagecolor{yellow}
\usepackage[most]{tcolorbox}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tcolorbox}[
%    standard jigsaw,
    enhanced,    
    title=Title,
    coltitle = red,
%    titlerule style={red,arrows = {Hooks[arc=270]-Hooks[arc=270]}} ] <= I'd like it to be transparent
%    attach boxed title to top left, % <= I'd like it to be transparent
     opacityframe=0,    
    opacityback=0,  
    opacitybacktitle=0,
]
This should have transparent backround. \\
Background should look yellow. 
\end{tcolorbox}
\end{document}

答案1

使用boxed titles,标题样式独立于 tcolorbox 样式,那么您必须将不透明度选项重复放入boxed title style

通常,这frame不是一条线,而是一个填充的框,colback框被添加到上面。这就是为什么opacityback=0最终的框显示较暗的原因,因为框架仍然可见。

\documentclass[tikz]{article}
\usepackage{xcolor}
\usepackage{pagecolor}
\pagecolor{yellow}
\usepackage[most]{tcolorbox}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tcolorbox}[
%    standard jigsaw,
    enhanced,    
    title=Title,
    coltitle = red,
%    titlerule style={red,arrows = {Hooks[arc=270]-Hooks[arc=270]}}, % <= I'd like it to be transparent
%    attach boxed title to top left, % <= I'd like it to be transparent
     opacityframe=0,    
    opacityback=0,  
    opacitybacktitle=0,
]
This should have transparent backround. \\
Background should look yellow. 
\end{tcolorbox}

\begin{tcolorbox}[
%    standard jigsaw,
    enhanced,    
    title=Title,
    coltitle = red,
%    titlerule style={red,arrows = {Hooks[arc=270]-Hooks[arc=270]}}, %  <= I'd like it to be transparent
    attach boxed title to top left, % <= I'd like it to be transparent
     opacityframe=0,    
    opacityback=0,  
    opacitybacktitle=0,
    boxed title style={opacityframe=0, opacityback=0}
]
This should have transparent backround. \\
Background should look yellow. 
\end{tcolorbox}

\begin{tcolorbox}[
%    standard jigsaw,
    enhanced,    
    title=Title,
    coltitle = red,
    titlerule style={red,arrows = {Hooks[arc=270]-Hooks[arc=270]}}, % <= I'd like it to be transparent
    %attach boxed title to top left, % <= I'd like it to be transparent
    opacityframe=0,    
    opacityback=0,  
%   opacitybacktitle=0,
%   boxed title style={opacityframe=0, opacityback=0}
]
This should have transparent backround. \\
Background should look yellow. 
\end{tcolorbox}
\end{document}

在此处输入图片描述

相关内容