分项文本不符合 tcbset 颜色

分项文本不符合 tcbset 颜色

这是我的mwe投影机。如您所见,在hlcard环境中,普通文本会改变其颜色,但不会itemized environment

\documentclass[8pt,xcolor=dvipsnames,xcolor=table, handout]{beamer}
\mode<presentation>
\usepackage[customcolors,shade]{hf-tikz}
\usetikzlibrary{arrows,shadows,petri,decorations.markings,shapes}
\RequirePackage[many]{tcolorbox}
\usepackage{mathtools}\definecolor{dcol}{named}{Maroon}
    \tcbset{%
        left=6mm, right=6mm, top=6mm, bottom=6mm, middle=4mm,
    }

    \tcbset{%
        outerlayer/.style={%
                enhanced,
                sharpish corners=all,
                colbacktitle=dcol,
                coltitle=white, coltext=dcol,
                left=1mm,
                right=1mm,
                top=1mm,
                bottom=1mm,
                middle=4mm,
                toptitle=1mm,
                bottomtitle=1mm,
                fuzzy shadow={0mm}{0.9mm}{0.6mm}{0.2mm}{black!20!Grey}, % top
                fuzzy shadow={0mm}{-0.6mm}{-0.1mm}{0.2mm}{black!40!Grey}, % bottomSmall
                fuzzy shadow={0mm}{-0.2mm}{-0.2mm}{0.2mm}{black!20!Grey}, % bottomBig
                title filled, boxrule=0mm, %
                segmentation code={\path[draw=BGrey](segmentation.west) -- (segmentation.east);}
            },
        innerlayer/.style={outerlayer,
                noparskip,
                breakable,
                colback=dcol,%
                coltitle=black,
                coltext=White,
                fonttitle={\bfseries \scshape},
                bottomtitle=1mm}
    }

    \newtcolorbox{card}[1][]{%
        outerlayer,
        title=#1,
    }

    \newtcolorbox{hlcard}[1][]{%
        innerlayer,
        colback=Teal,
        box align=base,
        #1
    }

\begin{document}
\begin{frame}{}
    \begin{hlcard}[]
        Hello from normal text
        \begin{itemize}
            \item Hello from itemized text
        \end{itemize}
    \end{hlcard}
\end{frame}

\end{document}

我在这里做错了什么?

在此处输入图片描述

答案1

作为 Werners 回答的后续此主题,我建议您在颜色框开始时将颜色更改为自定义颜色(MWE 中的白色),并normal color在结束时改回。


梅威瑟:

\documentclass[8pt,xcolor=dvipsnames,xcolor=table, xcolor=svgnames, handout]{beamer}
% \mode<presentation>

\usepackage[customcolors,shade]{hf-tikz}
\usetikzlibrary{arrows,shadows,petri,decorations.markings,shapes}
\RequirePackage[many]{tcolorbox}
\usepackage{mathtools}\definecolor{dcol}{named}{Maroon}

\tcbset{%
  left=6mm, right=6mm, top=6mm, bottom=6mm, middle=4mm,
}

\tcbset{%
  outerlayer/.style={%
    enhanced,
    sharpish corners=all,
    colbacktitle=dcol,
    coltitle=white, coltext=dcol,
    left=1mm,
    right=1mm,
    top=1mm,
    bottom=1mm,
    middle=4mm,
    toptitle=1mm,
    bottomtitle=1mm,
    fuzzy shadow={0mm}{0.9mm}{0.6mm}{0.2mm}{black!20!Grey}, % top
    fuzzy shadow={0mm}{-0.6mm}{-0.1mm}{0.2mm}{black!40!Grey}, % bottomSmall
    fuzzy shadow={0mm}{-0.2mm}{-0.2mm}{0.2mm}{black!20!Grey}, % bottomBig
    title filled, boxrule=0mm, %
    segmentation code={\path[draw=BGrey](segmentation.west) -- (segmentation.east);}
  },
  innerlayer/.style={outerlayer,
    noparskip,
    breakable,
    colback=dcol,%
    coltitle=black,
    coltext=White,
    fonttitle={\bfseries \scshape},
    bottomtitle=1mm}
}

\newtcolorbox{card}[1][]{%
  outerlayer,
  title=#1,
}

\newtcolorbox{hlcard}[1][]{%
  innerlayer,
  colback=Teal,
  box align=base,
  before upper={\setbeamercolor{item}{fg=white}},
  after upper={\setbeamercolor{item}{fg=normal color}}
  #1
}

\makeatletter
\def\beamer@origitem{%
  \@inmatherr\item\@ifnextchar[\@item{\@noitemargtrue\@item[\@itemlabel]%
  \csname beamer@thcfg@\beameritemnestingprefix item\endcsname% Insert colour in \beamer@thc@fg
  \ifx\beamer@thc@fg\@empty\relax\else\color{\beamer@thc@fg}\fi% Execute colour
  }}
\makeatother

\begin{document}

\begin{frame}{}
  \begin{hlcard}[]
    Text inside hlcard
    \begin{itemize}
    \item Itemize Text
    \end{itemize}
  \end{hlcard}

  Text outside hlcard

  \begin{itemize}
  \item Normal itemize text
  \item Foo
  \item Bar
  \item Baz
  \end{itemize}
\end{frame}

\end{document}

在此处输入图片描述

相关内容