PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Farbverlauf mit dem tikz-package?



sharpType
02-11-2009, 17:47
Hallo,

ich würde gerne einmal wissen, wie man einen derartigen Farbverlauf hinbekommt (s. Anhang). Kann mir dabei jmd helfen?

Ich nutze das tikz-Package für solche Darstellungen.

Ich formatiere zb meine Chapter-Überschriften wie folgt:



\newcommand*\chapterlabel{}
\titleformat{\chapter}
{\gdef\chapterlabel{}
\normalfont\sffamily\Huge\bfseries\scshape}
{\gdef\chapterlabel{\thechapter\ }}{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-3cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=LinkColor] (0,0) rectangle
(\paperwidth,3cm);
\node[drop shadow={shadow scale=1, shadow xshift=.25ex, shadow yshift=-.25ex,%
opacity=.5, fill=black!50,every shadow},anchor=east,xshift=.9\paperwidth,rectangle ,
rounded corners=20pt,inner sep=11pt,
fill=\chapterHeadFillColor]
{\textcolor{white}{\chapterlabel#1}};
\end{tikzpicture}
};
\end{tikzpicture}
}
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}

\newcommand*\chapterHeadFillColor{black}
\newcommand*\setchapterHeadFillColor[1]{\renewcommand*\chapterHeadFillColor{#1}}



Würde jetzt nur noch gerne so einen minimalen Farbverlauf zw. dem rectangle und dem weißen hintergrund des blattes hinbekommen :confused:

Vielen Dank schon mal

esdd
04-11-2009, 13:00
Hallo,

ein lauffähiges Minimalbeispiel wäre hilfreich gewesen.

Dein Wunsch lässt sich mit der tikzlibrary fadings realisieren:



\documentclass{scrreprt}

\usepackage[explicit]{titlesec}

\usepackage{tikz}
\usetikzlibrary{shadows,fadings}

\colorlet{LinkColor}{blue!60!black}

\newcommand*\chapterlabel{}
\titleformat{\chapter}
{\gdef\chapterlabel{}
\normalfont\sffamily\Huge\bfseries\scshape}
{\gdef\chapterlabel{\thechapter\ }}{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-3cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill,LinkColor] (0,0) rectangle(\paperwidth,3cm);
\fill[path fading=south,LinkColor](0,0)rectangle(\paperwidth,-0.3cm);
\node[drop shadow={shadow xshift=.25ex,shadow yshift=-.25ex},
anchor=east,xshift=.9\paperwidth,rectangle,
rounded corners=20pt,inner sep=11pt,
fill=\chapterHeadFillColor]
{\textcolor{white}{\chapterlabel#1}};
\end{tikzpicture}
};
\end{tikzpicture}
}
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}

\newcommand*\chapterHeadFillColor{black}
\newcommand*\setchapterHeadFillColor[1]{\renewcommand*\chapterHeadFillColor{#1}}

\begin{document}
\chapter{Test}
\end{document}

sharpType
04-11-2009, 14:22
genial :eek:


das war genau das was ich gesucht habe. sorry für das nichtvorhandene minibsp.

Vielen Dank! :)

sharpType
08-11-2009, 21:33
Ich habe da nochmal so ein Problem :o

Bin irgendwie zu blöd für dieses tikz package...Vielleicht kann man mir ja nochmal helfen. Ich möchte das Bsp hier:



\documentclass{scrreprt}

\usepackage[explicit]{titlesec}

\usepackage{tikz}
\usetikzlibrary{shadows,fadings}

\colorlet{LinkColor}{blue!60!black}

\newcommand*\chapterlabel{}
\titleformat{\chapter}
{\gdef\chapterlabel{}
\normalfont\sffamily\Huge\bfseries\scshape}
{\gdef\chapterlabel{\thechapter\ }}{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-3cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\fill[path fading=west,red,blue](0,0)rectangle(\paperwidth,6cm);
\node[drop shadow={shadow xshift=.25ex,shadow yshift=-.25ex},
anchor=east,xshift=.9\paperwidth,rectangle,
rounded corners=20pt,inner sep=11pt,
fill=\chapterHeadFillColor]
{\textcolor{white}{\chapterlabel#1}};
\end{tikzpicture}
};
\end{tikzpicture}
}
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}

\newcommand*\chapterHeadFillColor{black}
\newcommand*\setchapterHeadFillColor[1]{\renewcommand*\chapterHeadFillColor{#1}}

\begin{document}
\chapter{Test}
\end{document}



anpassen, so dass es genauso aussieht bzw. vom konstrukt her und den schattierungen sowie dem doppelten farbverlauf wie in der anlage. ich hab leider nur das obige ergebnisse hinbekommen (jetzt mal abgesehen von den farbdefinitionen) :(

vielleicht kann mir ja nochmal jmd helfen

Vielen dank schon mal

alexraasch
09-11-2009, 10:55
Etwa so?


\documentclass{scrreprt}

\usepackage[explicit]{titlesec}

\usepackage{tikz}
\usetikzlibrary{shadows,fadings}

\colorlet{LinkColor}{blue!60!black}

\newcommand*\chapterlabel{}
\titleformat{\chapter}
{\gdef\chapterlabel{}
\normalfont\sffamily\Huge\bfseries\scshape}
{\gdef\chapterlabel{\thechapter\ }}{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-3cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\fill[path fading=west,red,blue](0,0)rectangle(\paperwidth,3cm);
\node at (2,1.5) {\textcolor{black}{\chapterlabel#1}};
\end{tikzpicture}
};
\end{tikzpicture}
}
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}

\newcommand*\chapterHeadFillColor{black}
\newcommand*\setchapterHeadFillColor[1]{\renewcommand*\chapterHeadFillColor{#1}}

\begin{document}
\chapter{Test}
Lorem ipsum dolor, sit intra te concordia et publica felicitas.
\end{document}

sharpType
09-11-2009, 14:07
neee, es geht eher um den dreifachen farbverlauf von blau zu dunkelblau und dann zu schwarz. UND um den kleinen schwarzen schatten unter dem gesamten kasten im übergang zu dem weißen blatt....:rolleyes:

esdd
09-11-2009, 20:37
Oder so?


\documentclass{scrreprt}

\usepackage[explicit]{titlesec}

\usepackage{tikz}
\usetikzlibrary{shadows,fadings}

\newcommand*\chapterlabel{}
\titleformat{\chapter}
{\gdef\chapterlabel{}
\normalfont\sffamily\Huge\bfseries\scshape}
{\gdef\chapterlabel{\thechapter\ }}{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-3cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\fill[left color=blue!70!white,right color=black,middle color=blue!40!black](0,0)rectangle(\paperwidth,3cm);
\fill[path fading=south,black!60!white](0,0)rectangle(\paperwidth,-0.1cm);
\node[opacity=0.85,text=white,anchor=west,text width=0.94\paperwidth, inner sep=0pt] at (0.03\paperwidth,1.5) {\chapterlabel#1};
\end{tikzpicture}
};
\end{tikzpicture}
}
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}

\begin{document}
\chapter{Test Test Test Test Test Test Test Test Test}
Lorem ipsum dolor, sit intra te concordia et publica felicitas.
\end{document}

sharpType
10-11-2009, 08:22
:eek::eek::eek:

perfekt!!!


vielen vielen dank