-
Notifications
You must be signed in to change notification settings - Fork 1
DefinedColor
jdubs edited this page Oct 21, 2016
·
1 revision
Creates a Pageflex.Scripting.Color object and assigns appropriate values based on type.
DefinedColor("CustomColor_CMYK", "cmyk", "100-80-60-0");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.");
}
}