주어진 방사형 음영을 변경하려고합니다.
\documentclass[10pt]{article}
\usepackage{blindtext}
\usepackage{XCharter}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[x11names,svgnames,dvipsnames]{xcolor}
\usepackage[tikz]{bclogo}
\usetikzlibrary{calc}
\usetikzlibrary{shapes}
\usepackage[most]{tcolorbox}
\definecolor{recyclecolor}{RGB}{154,84,158}
\makeatletter
\tcbset{%
decoration downshift/.store in={\decoration@downshift},
decoration radius/.store in={\decoration@radius},
decoration recycle radius/.store in={\decoration@recyclecircleradius},
decoration dot radius/.store in={\decoration@dotradius},
decoration content/.store in={\decoration@content},
decoration colour/.store in={\decoration@colour},
}
\tcbset{recyclebox/.style={decoration radius=0.5cm,decoration downshift=-0.5cm}}
\tcbset{learnthisbox/.style={%
decoration radius=0.5cm,
decoration downshift=-0.5cm,
decoration content={\bclampe},
decoration colour=blue}
}
\newtcolorbox{recyclebox}[2][]{%
recyclebox,
decoration recycle radius={0.6*\decoration@radius},
decoration dot radius={0.04*\decoration@radius},
decoration colour=recyclecolor,
breakable,
enhanced jigsaw,
leftrule=1.5pt,
fonttitle={\bfseries\large},
title={\MakeUppercase{Recycle!}},
#1,
attach title to upper={{\bfseries\large #2}\par},
interior style={shading=radial,inner color=tcbcol@back!0,outer color=tcbcol@back},
underlay unbroken and first={%
\draw[tcbcol@frame,line width=\kvtcb@left@rule,fill=tcbcol@back] ($(frame.north west) + (\kvtcb@[email protected],\decoration@downshift)$) arc [start angle=90.0,end angle=270.0,radius=\decoration@radius] node[midway,inner sep=0pt] (dottedcircle) {};
\foreach \x in {1,...,12} {%
\draw[fill=tcbcol@back,opacity=4*(\x/12),tcbcol@frame] ($(dottedcircle) + (\decoration@radius,0cm)+(120+\x*30:\decoration@recyclecircleradius)$) circle (\decoration@dotradius);
};
},
colframe={\decoration@colour},
colback={tcbcol@frame!30},
coltitle={tcbcol@frame!150},
}
\makeatother
\begin{document}
\begin{recyclebox}[decoration radius={0.4cm},decoration dot radius=0.03cm]{~title}
\blindtext[1]
\end{recyclebox}
\end{document}
내가 원하는 것은 흰색 채우기가 더 커지도록 방사형 음영을 늘리는 것입니다.
코드는 다음을 보여줍니다:
또 다른 종류의 쉐이딩이 있나요? 직사각형? 어떻게 하나요?
답변1
방사형 음영을 변경하는 핵심은 입니다 \pgfdeclareradialshading
. 설명서를 참조하세요 pgf
.109.2.2 Radial Shadings
\pgfdeclareradialshading[inner color,middle color, outer color]{ustanakradial}{\pgfpoint{0.0cm}{0.0cm}}%
{ color(0)=(inner color);
color(10bp)=(middle color);
color(28bp)=(outer color)
}
ustanakradial
이는 관련 반경이 있는 원에 적용되는 일부 기호 색상 이름을 사용하여 라는 방사형 음영을 정의합니다 . 10pt
및 값은 28pt
'추측'일 뿐입니다. 과장하지 마세요.
여기서 음영의 중심은 으로 고정됩니다 \pgfpoint{0cm}{0cm}
.
\documentclass[10pt]{article}
\usepackage{blindtext}
\usepackage{XCharter}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[x11names,svgnames,dvipsnames]{xcolor}
\usepackage[tikz]{bclogo}
\usetikzlibrary{calc}
\usetikzlibrary{shapes}
\usepackage[most]{tcolorbox}
\definecolor{recyclecolor}{RGB}{154,84,158}
\makeatletter
\tikzset{%
ustanakradial inner color/.code={\colorlet{inner color}{#1}},
ustanakradial middle color/.code={\colorlet{middle color}{#1}},
ustanakradial outer color/.code={\colorlet{outer color}{#1}},
}
\tcbset{%
decoration downshift/.store in={\decoration@downshift},
decoration radius/.store in={\decoration@radius},
decoration recycle radius/.store in={\decoration@recyclecircleradius},
decoration dot radius/.store in={\decoration@dotradius},
decoration content/.store in={\decoration@content},
decoration colour/.store in={\decoration@colour},
}
\tcbset{recyclebox/.style={decoration radius=0.5cm,decoration downshift=-0.5cm}}
\tcbset{learnthisbox/.style={%
decoration radius=0.5cm,
decoration downshift=-0.5cm,
decoration content={\bclampe},
decoration colour=blue}
}
\pgfdeclareradialshading[inner color,middle color, outer color]{ustanakradial}{\pgfpoint{0.0cm}{0.0cm}}%
{ color(0)=(inner color);
color(10bp)=(middle color);
color(28bp)=(outer color)
}
\newtcolorbox{recyclebox}[2][]{%
recyclebox,
decoration recycle radius={0.6*\decoration@radius},
decoration dot radius={0.04*\decoration@radius},
decoration colour=recyclecolor,
breakable,
enhanced jigsaw,
leftrule=1.5pt,
fonttitle={\bfseries\large},
title={\MakeUppercase{Recycle!}},
#1,
attach title to upper={{\bfseries\large #2}\par},
interior style={shading=ustanakradial,ustanakradial inner color=tcbcol@back!0,ustanakradial middle color=tcbcol@back!0,ustanakradial outer color=tcbcol@back},
underlay unbroken and first={%
\draw[tcbcol@frame,line width=\kvtcb@left@rule,fill=tcbcol@back] ($(frame.north west) + (\kvtcb@[email protected],\decoration@downshift)$) arc [start angle=90.0,end angle=270.0,radius=\decoration@radius] node[midway,inner sep=0pt] (dottedcircle) {};
\foreach \x in {1,...,12} {%
\draw[fill=tcbcol@back,opacity=4*(\x/12),tcbcol@frame] ($(dottedcircle) + (\decoration@radius,0cm)+(120+\x*30:\decoration@recyclecircleradius)$) circle (\decoration@dotradius);
};
},
colframe={\decoration@colour},
colback={tcbcol@frame!30},
coltitle={tcbcol@frame!150},
}
\makeatother
\begin{document}
\begin{recyclebox}[decoration radius={0.4cm},decoration dot radius=0.03cm]{~title}
\blindtext[1]
\end{recyclebox}
\end{document}