Contents Previous Next

4.8 Specifying colors in JpGraph

Colors can be specified in three different ways

  1. By using one of the, roughly, 400 pre-defined color names, e.g
     SetColor ("khaki");

    A named color can also be modified by adding a adjustment factor. An adjustment factor, 0 < f < 1, a smaller value will give a darker version and a value of 0 or 1 will return the original color. A value > 1 will make the color brighter. A few examples

     SetColor ("khaki:0.5" ); // A darker version of "khaki"
    SetColor("yellow:1.2");  // A slightly lighter version of "yellow"

  2. By specifying a RGB triple, e.g.
     SetColor(array(65, 100,176));

  3. By specifying the color as a hex string value
     SetColor ("#A16BFF");

Contents Previous Next