Skip to content

DefinedColor

jdubs edited this page Oct 21, 2016 · 1 revision

Table of Contents

Overview

Creates a Pageflex.Scripting.Color object and assigns appropriate values based on type.

Syntax

DefinedColor("CustomColor_CMYK", "cmyk", "100-80-60-0");

Source Code

internal static string DefinedColor(object Color, object ColorType, object Definition)
{
	uint val;
	object type;

	bool IsNamed = !(UInt32.TryParse(ColorType.ToString(), out val));
	if (IsNamed)
		type = Enum.Parse(typeof(ColorTypes), (string)ColorType, true);
	else
		type = (ColorTypes)Convert.ToUInt32(ColorType);

	switch ((ColorTypes)type)
	{
		case ColorTypes.Cmyk:
			return new CmykColor((string)Color, (string)Definition).ToString();
		case ColorTypes.Rgb:
			return new RgbColor((string)Color, (string)Definition).ToString();
		case ColorTypes.Name:
			return (string)Color;
		default:
			throw new Four51ActionsException("Color type or definition not valid.");
	}
}

References

Clone this wiki locally