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 create a Go stone in TikZ. "ball color" option in node style is almost OK.
Here is my result:

alt text

But I don't like the stones, they are "too balish". The "reflection" should be less spot-on and more ambient.

I could get such a result if I could manipulate both shading colors or shading curve. Can I do it in TikZ?

Here is what I want to achieve:

alt text

PS. Any ideas to render wood-like background w/o texture?

share|improve this question
MAybe I should use inkscape to draw stone and use it in TikZ? Is it possible to import a drawing from inkspace to Tikz? –  Łukasz Lew Aug 18 '10 at 14:14
You can easily with the traditional \includegraphics (which I use). pgf also offers something similar for this. –  Leo Liu Aug 18 '10 at 14:21
But you have gotten pretty close to what you want just needs a bit of tweaking. –  Leo Liu Aug 18 '10 at 14:21
Will \pgfimage allow you to position stone graphics at will? –  Mikael Vejdemo-Johansson Aug 18 '10 at 14:27
The question regarding a wood-like background could be discussed in a separate question. It doesn't fit to the original question and its title. –  Stefan Kottwitz Aug 18 '10 at 14:35
show 2 more comments

3 Answers

You can get an effect like the shading on the go stones in the picture with radial shading. I don't know how to get radial shading off-center, so some clipping is needed:

        \fill[black] (0,0) circle (0.5);
        \clip (0,0) circle (0.5);
        \shade[outer color=black, inner color=black!30] (-0.15,0.5) circle (0.7);

an example

The scope is needed in order to have the clipping only applied to the shading.

I had some time to kill and the following is the result:

go board example

This is produced with the following code


        stone/.style={drop shadow={shadow xshift=0.03, shadow yshift=-0.05}},
        black-highlight/.style={outer color=black!80, inner color=black!30},
        white-highlight/.style={outer color=white!70!black, inner color=white},
        \fill[brown!80] (-1,-1) rectangle (19,19);
        \draw[black] (0,0) grid (18,18);
        \draw[thick,black] (0,0) rectangle (18,18);
        \fill (3,3) circle (0.1);
        \fill (3,9) circle (0.1);
        \fill (3,15) circle (0.1);
        \fill (9,3) circle (0.1);
        \fill (9,9) circle (0.1);
        \fill (9,15) circle (0.1);
        \fill (15,3) circle (0.1);
        \fill (15,9) circle (0.1);
        \fill (15,15) circle (0.1);

        \fill[stone,#2-stone] (#3,#4) circle (0.45);
        \clip (#3,#4) circle (0.45);
        \shade[#2-highlight] (-0.15+#3,0.5+#4) circle (0.7);
    \node[#2-number] at (#3,#4) {\sffamily\bfseries{#1}};


The syntax for the goboard environment and \gostone command is modeled after the psgo package.

share|improve this answer
This is almost perfect! Can I create style for node that will look like that? Or do I have to create new command ? –  Łukasz Lew Aug 18 '10 at 15:42
ball shading is an option. –  Łukasz Lew Aug 18 '10 at 15:43
@Łukasz: I don't know how to do this as a node, but I updated the answer with some code to automate the drawing. –  Caramdir Aug 18 '10 at 16:03
add comment

This only concerns your additional question, e.g. how to get such a "wood like" background:



% parameters for the "wooden rectangle", chosen to be measures of a Go board

\begin{tikzpicture}[scale=0.5,spy using outlines={circle, size=7cm, connect spies}]
    %auto generated wood board  
    \filldraw[\backgroundcolor] (0,0) rectangle (\boardwidth,\boardheight);




    \foreach \x in {1,2,...,\numberoffibres}
    {   \fill[\fibrecolor] ($(\x*\segmentwidth-\segmentvariation,0) + (rand*\relativefibrevariation*\relativefibrethickness,0)$) 
        \foreach \y in {1,...,\fibresteps}
        {   -- ($(\x*\segmentwidth-\segmentvariation,\y*\stepheight) + (rand*\relativefibrevariation*\relativefibrethickness,0)$)
        -- ($(\x*\segmentwidth+\segmentvariation,\boardheight)+ (rand*\relativefibrevariation*\relativefibrethickness,0)$) 
        \foreach \y in {\fibresteps,...,0}
        {   -- ($(\x*\segmentwidth+\segmentvariation,\y*\stepheight) + (rand*\relativefibrevariation*\relativefibrethickness,0)$)
        -- cycle;
    \draw[thick] (0,0) rectangle (\boardwidth,\boardheight);

    % manually added stuff, only for Go board look  
    \draw (1,1) grid (19,19);
    \foreach \x in {4,10,16}
    {   \foreach \y in {4,10,16}
        {   \fill (\x,\y) circle (0.1);
    % spy for seeing the structure
    \spy[magnification=10,yellow] on (5.3,5.8) in node at (8,-8);


enter image description here

share|improve this answer
add comment

You could use \pgfdeclareradialshading to modify the ball shading.

For example, insert:


The "reflection" will be less spotty and more ambient than with the original code:

alt text

Adjust the color values according to your needs.

share|improve this answer
That looks great ;) –  Leo Liu Aug 18 '10 at 14:37
add comment

Your Answer


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.