weaken color

Prev Next

Function Names

weaken color

Library

Style Library

Description

This function derives a weakened shade of a specified color

Call as: function

Restrictions

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

Parameter count

2

Parameters

No.TypeDescription
1.
input
parameter set
string
Color

Three possibiltes to specify the color:

  • As RGB in a parameter 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

2.
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 lighter shades, and bigger factors (e.g. 4) for significantly lighter shades.

Return value

TypeDescription
parameter set RGB color

The color is specified in a parameter set containing 3 numbers (0..255).

Examples

  for (i[] = 1, i[] <4, i[]++)
  {
      echo( new line, "Factor ", i[],":" );
      echo( "  Orange: ", weaken color( orange, i[] ));
      echo( "  Navy:   ", weaken color( {0,0,128}, i[] ));
      echo( "  Teal:   ", weaken color( "#008080", i[] ));
  }

Output

Factor 1:
  Orange: {255,192,0}
  Navy:   {0,0,128}
  Teal:   {0,128,128}

Factor 2:
  Orange: {222,191,95}
  Navy:   {8,8,72}
  Teal:   {45,109,109}

Factor 3:
  Orange: {211,190,126}
  Navy:   {10,10,53}
  Teal:   {60,103,103}
Try it yourself: Open LIB_Function_weaken_color.b4p in B4P_Examples.zip. Decompress before use.

See also

weaken colors
lighten color
darken color