|  | HTML |  |
|  | Splash! |  |
|  | PostScript |  |
| Template Toolkit Examples: HTML Library: RGB Colours |

|  | index |  |
|  | rgb |  |
|  | headers |  |
|  | lists |  |
|  | links |  |
|  | tables |  |
|  | bars |  |
|  | menus |  |
# RGB Colours The html/rgb file defines an 'rgb' hash array which contains RGB triples for various colours. It also defines a number of hash arrays within the parent hash that contain dark, mid and light colours of a particular shade.
Source #1:
    [% PROCESS html/rgb %]
    [% rgb.marine %]
| Output #1: #0066cc
Source #2:
    [% PROCESS html/rgb %]

    <b>Colours:</b>
    <ul>
    <table border=0>
    [% FOREACH col = rgb.keys.sort -%]
       [%- NEXT IF rgb.${col}.keys # skip hashes %]
    <tr>
      <td bgcolor="[% rgb.white %]">
      <b>[% col %]</b>
      </td>
      <td bgcolor="[% rgb.$col %]">
      [% '&nbsp;' | repeat(5) %]
      </td>
      <td bgcolor="[% rgb.white %]">
      ([% rgb.$col %])
      </td>
    </tr>
    [% END -%]
    </table>
    </ul>
| Output #2: Colours:
aqua |  | (#3399cc)
black |  | (#000000)
blood |  | (#800000)
blue |  | (#0000ff)
blue25 |  | (#000040)
blue50 |  | (#000080)
blue75 |  | (#0000c0)
bud |  | (#66aa66)
green |  | (#00ff00)
green25 |  | (#004000)
green50 |  | (#008000)
green75 |  | (#00c000)
grey25 |  | (#404040)
grey50 |  | (#808080)
grey75 |  | (#c0c0c0)
leaf |  | (#006400)
lilac |  | (#9797ff)
marine |  | (#0066cc)
mauve |  | (#6666cc)
mint |  | (#aaffaa)
navy |  | (#202080)
orange |  | (#fe7202)
purple |  | (#404080)
red |  | (#ff0000)
red25 |  | (#400000)
red50 |  | (#800000)
red75 |  | (#c00000)
rose |  | (#f08080)
scarlet |  | (#c04040)
sky |  | (#66ccff)
white |  | (#ffffff)
Source #3:
    [% rgb.blue.mid %] == [% rgb.marine %] == #0066cc
Output #3: == #0066cc == #0066cc
Source #4:
    <table border=0>
    [%- FOREACH col = ['grey' 'red' 'green' 'blue' 'lavender'] %]
    <tr>
      <td bgcolor="[% rgb.white %]">
      <b>[% col %]</b>
      </td>
      [%- FOREACH shade = ['dark' 'mid' 'light'] %]
      <td bgcolor="[% rgb.${col}.${shade} %]">
      [% shade %] [% col %]<br>(rgb.[% col %].[% shade %])
      </td>
      [%- END %]
    </tr>
    [%- END %]
    </table>
    </ul>
Output #4:
grey | dark grey (rgb.grey.dark) | mid grey (rgb.grey.mid) | light grey (rgb.grey.light)
red | dark red (rgb.red.dark) | mid red (rgb.red.mid) | light red (rgb.red.light)
green | dark green (rgb.green.dark) | mid green (rgb.green.mid) | light green (rgb.green.light)
blue | dark blue (rgb.blue.dark) | mid blue (rgb.blue.mid) | light blue (rgb.blue.light)
lavender | dark lavender (rgb.lavender.dark) | mid lavender (rgb.lavender.mid) | light lavender (rgb.lavender.light)