add color

Prev Next

Function Names

add color

Library

Style Library

Description

This function adds a further color to the color palette.

Call as: procedure

Restrictions

Don't forget to include 'Style Library' at the top of your program

Parameter count

3

Parameters

No.TypeDescription
1.
input
string New color name

Specify a new color name which does not yet exist in the color table

2.
input
string Category 2

Apply a categorization, e.g. an existing one like "gray scale" or a new one of choice. This value will noted down as "Cat 2" in the color table. The 1st category is assigned automatically with "user defined".

3.
input
set
string
Color

Three possibiltes to specify the color:

  • As RGB in a set containing 3 numbers (0..255). Example: { 255, 128, 64 }
  • Existing color name. Example: red, blue, navy, ecru
  • Hexadecimal code: '#' followed by 6 hexdecimal digits. Example: #FF8040

Examples


       add color( crème, natural shades, {245, 238, 222} );

       table initialize( t, { { Item, Color }, { Jacket, crème }, { Trousers, gray 12 }, { scarf, teal } } );

       table process( t, table style cells( t, Color, row(), single, fill color, [Color] ) );

       table save( t, "Images/Style_Custom_Colors.html", HTML );
       table save( t, "Images/Style_Custom_Colors.xls", EXCEL );
       table save excel file( t, Contents, "Images/Style_Custom_Colors.xlsx" );

Output

    Saved table(s) to EXCEL file 'Images/Style_Custom_Colors.xlsx' containing 1 sheets.

Try it yourself: Open LIB_Function_add_color.b4p in B4P_Examples.zip. Decompress before use.

Viewing the Results:

Test Click on the file name view the result: Style_Custom_Colors.html.
Test Click on the file name open the file with Excel XML 2003: Style_Custom_Colors.xls (Excel XML 2003 format - confirm the message box query).
Test Click on the file name open the file with Excel (.xlsx) : Style_Custom_Colors.xlsx (Excel .xlsx format).