CellFill

Revision as of 00:13, 9 October 2021 by Lchrisman (Talk | contribs) (Var..Do to Local..Do)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


New to Analytica 5.0

CellFill( color, alpha )

Specifies the background color for a table cell. This function can be used from within the Cell Format Expression attribute. Please see Computed cell formats for details.

Parameters:

  • «color»: The fill color, either an ARGB-integer, or the textual name of a color.
  • «alpha»: (Optional) The degree of transparency/opaqueness. Usually expressed on a 0.0 to 1.0 scale, where 0.0 is fully transparent (invisible) and 1.0 is fully opaque. Alternatively it accepts an integer value between 2 and 255, where 2 is nearly transparent (0 is fully transparent) and 255 is fully opaque. When «alpha» is provided, it overrides the alpha part of «color».

ARGB integers

An ARGB integer is an integer value equal to alpha*2^24 + red*2^16 + green*2^8 + blue, where alpha, red, green and blue are integers between 0 and 255. When the alpha channel is 0, it is assumed that «color» is an RGB integer with no alpha channel -- that the alpha channel was omitted -- which is equivalent to an alpha on 255 (fully opaque).

ARGB and RGB integers are often written in hex notation, 0xaarrggbb or 0xrrggbb, such as 0xFF0000 for red, 0x00FF00 for green, 0x0000FF for blue, or 0x40FF0000 for mostly transparent red.

Color names

Several textual color names are recognized for «color», as follows:

 Name Color         
AliceBlue 
AntiqueWhite 
Aqua 
Aquamarine 
Azure 
Beige 
Bisque 
Black 
BlanchedAlmond 
Blue 
BlueViolet 
Brown 
BurlyWood 
CadetBlue 
Chartreuse 
Chocolate 
Coral 
CornflowerBlue 
Cornsilk 
Crimson 
Cyan 
DarkBlue 
DarkCyan 
DarkGoldenrod 
DarkGray 
DarkGreen 
DarkKhaki 
DarkMagenta 
DarkOliveGreen 
DarkOrange 
DarkOrchid 
DarkRed 
DarkSalmon 
DarkSeaGreen 
DarkSlateBlue 
DarkSlateGray 
DarkTurquoise 
DarkViolet 
DeepPink 
DeepSkyBlue 
DimGray 
DodgerBlue 
Firebrick 
FloralWhite 
ForestGreen 
Fuchsia 
Gainsboro 
GhostWhite 
Gold 
Goldenrod 
Gray 
Green 
GreenYellow 
Honeydew 
HotPink 
IndianRed 
Indigo 
Ivory 
Khaki 
Lavender 
LavenderBlush 
LawnGreen 
LemonChiffon 
LightBlue 
LightCoral 
LightCyan 
LightGray 
LightGreen 
LightPink 
LightSalmon 
LightSeaGreen 
LightSkyBlue 
LightSlateGray 
LightSteelBlue 
LightYellow 
Lime 
LimeGreen 
Linen 
Magenta 
Maroon 
MediumAquamarine 
MediumBlue 
MediumOrchid 
MediumPurple 
MediumSeaGreen 
MediumSlateBlue 
MediumSpringGreen 
MediumTurquoise 
MediumVioletRed 
MidnightBlue 
MintCream 
MistyRose 
Moccasin 
NavajoWhite 
Navy 
OldLace 
Olive 
OliveDrab 
Orange 
OrangeRed 
Orchid 
PaleGoldenrod 
PaleGreen 
PaleTurquoise 
PaleVioletRed 
PapayaWhip 
PeachPuff 
PeaGreen 
Peru 
Pink 
Plum 
PowderBlue 
Purple 
Red 
RedPeach 
RosyBrown 
RoyalBlue 
SaddleBrown 
Salmon 
SandyBrown 
SeaGreen 
SeaShell 
Sienna 
Silver 
SkyBlue 
SlateBlue 
SlateGray 
SmoothBlue 
Snow 
SpringGreen 
SteelBlue 
Tan 
Teal 
Thistle 
Tomato 
Turquoise 
Violet 
Wheat 
White 
WhiteSmoke 
Yellow 
YellowGreen 

Alpha

Most named colors are too saturated or dark to make good fill colors, since it is hard to see the overlaid text. The «alpha» parameter gives a very convenient way to soften the color. For example, instead of CellFill('Red') which is usually too dark, use CellFill('Red', 0.2).

Alpha can also be used for computed intensities, such as in a heat map. For example, in a Computed cell format expression:

CellFill( 'Green', alpha:Abs(Self)/Max(Abs(Self), I) )

When you have two successive fill colors, only the later is used. Even if there is transparency in the last color, they are not blended. This includes the case where you've set the fill color from the Cell format dialog and then a computed expression also sets it. It also includes the case where a computed expression sets it twice, such as:

CellFormats( CellFill('Green'), CellFill('Yellow', 0.1) )

So in this example, the color used is CellFill('Yellow', 0.1), and not a blending of green with partially transparent yellow.

Examples

The next two have identical effect

CellFill('Green')
CellFill(0x008000)

CellFill('Blue') is pretty dark, making it hard to see the text. You can lighten it with a different color such as one of these:

CellFill('LightBlue')
CellFill(0xA0D0FF)
CellFill('Blue', 0.2)

A heat map, positive numbers green, negative numbers red. Result indexes here are I and J.

Local scale := Max( Abs(Self), I,J ) Do CellFill( If Self<0 Then 'Red' Else 'Green', Abs(Self)/scale )

See Also

Comments


You are not allowed to post comments.