VS:RGBToColorIndexN

From Vectorworks Developer
Revision as of 14:36, 12 August 2013 by Root (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Procedure RGBToColorIndexN converts the Vectorworks palette colors from its' red, green, and blue component values to the Vectorworks color index. Parameters red, green, and blue return the color components of the swatch, and parameter color is the Vectorworks color index. RGB values are in the range of 0~65535. Parameter ignoreBlackBackground specifies whether the black background preference should be ignored. If set to TRUE, black and white indexes will not be inverted in black background.

A color table listing with associated index values can be found in the Appendix.

PROCEDURE RGBToColorIndexN(
red :LONGINT;
green :LONGINT;
blue :LONGINT;
VAR color :INTEGER;
ignoreBlackBackground :BOOLEAN);
def vs.RGBToColorIndexN(red, green, blue, ignoreBlackBackground):
    return color

Parameters

red LONGINT RGB color component value.
green LONGINT RGB color component value.
blue LONGINT RGB color component value.
color INTEGER Color index.
ignoreBlackBackground BOOLEAN Ignore black background preference setting or not.

Example

PROCEDURE Example;
VAR
	red, green, blue :LONGINT;
	colorIndex :INTEGER;
BEGIN
	GetPenFore(FSActLayer, red, green, blue);
	RGBToColorIndexN(red, green, blue, colorIndex, TRUE);
	Message(colorIndex);
END;
RUN(Example)

Version

Availability: from Vectorworks 2010

See Also

Functions:

Functions:
  • [[VS:ColorIndexToRGB| ColorIndexToRGB]]
  • [[VS:ColorIndexToRGBN| ColorIndexToRGBN]]
  • [[VS:RGBToColorIndex| RGBToColorIndex]]