lighten colors

Prev Next

Function Names

lighten colors

Library

Style Library

Description

This function derives lightened shades of selected colors in 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
numeral
parameter set
Row numbers

Specify one or multiple table row numbers in the table 'global color table'. The colors specified in the corresponding row will be lightened.
Hint: Use table selected rows() to select table rows by contents in the table..

2.
input
numeral or string Suffix

Specify a suffix to be added to the color names in order to distinguish them from their original colors.

3.
input
numeral Lightening up factor

e.g. factor 2 is the color precisely between white and specified color
Example: mandarin {255,128,0} translates to {255,192,128}
Use lower factors (e.g. 1.5) for less lighter shades, and bigger factors (e.g. 4) for significantly lighter shades.

Examples


  lighten colors( table selected rows( global color table, [Cat 2]==primary), X, 3 );

  table copy table selected rows( global color table, t, [Cat 2]==primary );

  table list ( t );
  table process( t, table style rows( t, row(), table, fill color, [Color Name] ) );

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

Output

    0 : Color Name      | Cat 1     | Cat 2   | Red | Green | Blue | HTML Color
    1 : red             | standard  | primary | 255 | 0     | 0    | #FF0000   
    2 : yellow          | standard  | primary | 255 | 255   | 0    | #FFFF00   
    3 : green           | standard  | primary | 0   | 255   | 0    | #00FF00   
    4 : cyan            | standard  | primary | 0   | 255   | 255  | #00FFFF   
    5 : blue            | standard  | primary | 0   | 0     | 255  | #0000FF   
    6 : magenta         | standard  | primary | 255 | 0     | 255  | #FF00FF   
    7 : light red X     | lightened | primary | 255 | 171   | 171  | #FFABAB   
    8 : light yellow X  | lightened | primary | 255 | 255   | 171  | #FFFFAB   
    9 : light green X   | lightened | primary | 171 | 255   | 171  | #ABFFAB   
   10 : light cyan X    | lightened | primary | 171 | 255   | 255  | #ABFFFF   
   11 : light blue X    | lightened | primary | 171 | 171   | 255  | #ABABFF   
   12 : light magenta X | lightened | primary | 255 | 171   | 255  | #FFABFF   


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

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

Viewing the Results:

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

See also

lighten color
darken colors
weaken colors