Estoy intentando cambiar el sombreado radial dado:
\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}
Lo que quiero es aumentar el sombreado radial para que el relleno blanco sea más grande.
El código muestra:
¿Existe otro tipo de sombreado? ¿Rectangular? ¿Cómo hacerlo?
Respuesta1
La clave para cambiar un sombreado radial es \pgfdeclareradialshading
consultar el pgf
manual en109.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)
}
Esto define un sombreado radial llamado ustanakradial
, con algunos nombres de colores simbólicos que se aplican en los círculos con radios relevantes. Los valores de 10pt
y 28pt
son sólo "conjeturas". No los exageres.
El centro del sombreado se fija aquí en \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}