#!/bin/bash

#%# family=test

# Requires munin master version 1.2.5 or 1.3.3 or higher.
# Just draw coloured lines to show off palette.

#        Greens Blues Oranges Dk yel Dk blu Purple lime   Reds   Gray
COLOURS="00CC00 0066B3 FF8000 FFCC00 330099 990099 CCFF00 FF0000 808080
         008F00 00487D B35A00 B38F00        6B006B 8FB300 B30000 BEBEBE
         80FF80 80C9FF FFC080 FFE680 AA80FF EE00CC FF8080
         666600 FFBFFF 00FFCC CC6699 999900"

# Removed: Dark blue line 2: 24006B
# Removed: Line 3, pastels
# Removed: Purple line 3, FF80FF
# Removed: Line 3, column green.  Too light.
# Inserted: Gray column
# Inserted: New last line with misc colours not represented on the
# colour wheel; for this line the headlines are not accurate.

# http://www.visibone.com/color/chart_847.gif

I=1
for C in $COLOURS; do
    col[$I]="$C"
    I=$((I + 1))
done
NUMCOL=$((I - 1))


do_ () { # Fetch
   for I in $(seq 1 "$NUMCOL"); do
       echo "l$I.value $I"
   done
}

do_config () {
    echo "graph_title Colour testing plugin"
    echo "graph_vlabel Colour index and colour"
    for I in $(seq 1 "$NUMCOL"); do
        echo "l$I.label ${col[$I]}"
        echo "l$I.colour ${col[$I]}"
        echo "l$I.type GAUGE"
    done
}

case $1 in
    ''|config) eval "do_$1";;
    *) echo Error >&2; exit 1;;
esac
