Procedure ColorIndexToRGB converts the VectorWorks palette colors from the colors' palette position index to its red, green, and blue component values. RGB values are in the range of 0~65535. (Black: (0, 0, 0), White: (65535, 65535, 65535))
A color table listing with associated index values can be found in the Script Appendix.
PROCEDURE ColorIndexToRGB(
color : INTEGER;
VAR red : LONGINT;
VAR green : LONGINT;
VAR blue : LONGINT);def vs.ColorIndexToRGB(color):
return (red, green, blue)| Name | Type | Description |
|---|---|---|
| color | INTEGER | Color index. |
| red | LONGINT | RGB color component value. |
| green | LONGINT | RGB color component value. |
| blue | LONGINT | RGB color component value. |
ColorIndexToRGB(45, r, g, b);
{returns the color value components of the color at position 45}r, g, b = vs.ColorIndexToRGB(45)BEGIN
IF flag THEN ColorIndexToRGB(kRedIndex,r,g,b) ELSE ColorIndexToRGB(kYellowIndex,r,g,b);
hobj := FInGroup(h);
BEGIN
n := n + 1;
Rect (X1, Y1, X1 + boxSize, Y1 + boxSize);
ColorIndextoRGB (colorIndex[n], R, G, B);
SetFPat (LNewObj, 1);
SetFillBack (LNewObj, R, G, B);
IF showIndices THEN
BEGIN
GetChoiceText(dialogID, popupID, 1, strg);
ColorIndexToRGB(Str2Num(strg), r2, g2, b2);
diff := ColorDiff(r1, g1, b1, r2, g2, b2);
colorStr := strg;
GetChoiceCount(dialogID, popupID, itemCount);if classFound:
tempInt = vs.GetWSCellValue( wksHand, row, col + 1 )
# pen color
r, g, b = vs.ColorIndexToRGB( tempInt )
vs.SetClPenFore( userClassName, r, g, b )
tempInt = vs.GetWSCellValue( wksHand, row, col + 2 )
# line weight
vs.SetClLW( userClassName, tempInt )Functions:
- ColorIndexToRGBN
- RGBToColorIndex
- RGBToColorIndexN
- GetPenFore | GetPenBack| GetFillFore | GetFillBack
Availability: from MiniCAD 6.0