weaken colors

Prev Next

Function Names

weaken colors

Library

Style Library

Description

This function Derives weakened saturations 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 weakened.
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 Weakening down factor

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

Examples


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

  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], text color, white ) );

  table save( t, "Images/Style_Weakened_Colors.html", HTML );
  table save( t, "Images/Style_Weakened_Colors.xls", EXCEL );
  table save excel file( t, Contents, "Images/Style_Weakened_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 : weak red X     | weakened | primary | 112 | 61    | 61   | #703D3D   
    8 : weak yellow X  | weakened | primary | 232 | 232   | 181  | #E8E8B5   
    9 : weak green X   | weakened | primary | 120 | 171   | 120  | #78AB78   
   10 : weak cyan X    | weakened | primary | 144 | 195   | 195  | #90C3C3   
   11 : weak blue X    | weakened | primary | 24  | 24    | 75   | #18184B   
   12 : weak magenta X | weakened | primary | 136 | 85    | 136  | #885588   


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

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

Viewing the Results:

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

See also

weaken color
lighten colors
darken colors