Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to use the color of a path to set the color of the nodes. But I want the nodes to be lighter than the path color. And I want to do this before knowing what the path color will be. Hence, how do i get what will be active path color, so that I can adjust the node color?

share|improve this question
3  
Could you give a hypothetical example of what you'd like to be able to write? I'm finding it hard to envision a case where the node does not know the colour of the path that it is on. –  Andrew Stacey May 5 '11 at 12:31
    
@Andrew: if the color is declared (then changed) in a style, the \draw[style] command may not know what color that is. –  Matthew Leingang May 5 '11 at 17:27
    
@Matthew: I was thinking of hacking in to the lower level code and having the node look at the macro that holds the path's colour. –  Andrew Stacey May 5 '11 at 18:20
add comment

1 Answer

TikZ/PGF uses xcolor to store and manipulate color values. With xcolor the current color is always available as .. So, you can write

\documentclass{article}
\usepackage{tikz}

\begin{document} 
    \begin{tikzpicture}[red!50!blue]
        \fill[radius=1cm] circle 
            node[font={\bf\huge}] {\color{.!20}text};
    \end{tikzpicture}
\end{document}

to obtain

result

share|improve this answer
    
Very useful!! –  Matthew Leingang May 5 '11 at 17:25
    
@Matthew: Also have a look on \blendcolors. You might find it also very useful. However IIRC it doesn't work for the current color just for subsequent ones. –  Martin Scharrer May 5 '11 at 18:29
    
Thank you @peter and @PeterSmith for your comments! Here the problem in more detail: –  kunzo May 6 '11 at 9:49
    
Here is a sample that illustrates what I get \documentclass[12pt]{article} \usepackage{tikz} \usetikzlibrary{matrix,shapes} \definecolor{currentPathcolor}{rgb}{0.8 0.4 0.2} \tikzstyle{pathstyle}=[>=latex,>->,dashed] \tikzstyle{nodestyle}=[ellipse,inner sep=1pt,text=black,fill=.!20] \tikzstyle{nodestyleX}=[ellipse,inner sep=1pt,text=black,fill=currentPathcolor!20] \tikzstyle{mystyle}=[scale= .5, baseline=(current bounding box.center), style1/.style={ out=45,in=120,distance=3cm, line width=1.1pt}, style2/.style={ out=-45,in=-120,distance=3cm, min distance=2cm, line width=1.1pt} ] –  kunzo May 6 '11 at 9:55
1  
@kunzo: Please add the example to your question. This is unreadable. –  Caramdir May 6 '11 at 16:13
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.