Skip to content

Four51.RgbColor

jdubs edited this page Oct 21, 2016 · 1 revision

Overview

Constructs a Pageflex.Scripting.Color object and exposes the value for assignment to a defined color in the template file.

Syntax

return new RgbColor("CustomColor_RGB", "100-80-60").ToString();

Source Code

internal class RgbColor
{
	private string _name;
	private string _rgb;
	private uint[] Rgb
	{
		get
		{
			string[] input = _rgb.ToString().Split(new string[] { "-" }, StringSplitOptions.None);
			uint[] values = { Convert.ToUInt32(input[0]), Convert.ToUInt32(input[1]), Convert.ToUInt32(input[2]) };
			return values;
		}
	}

	public RgbColor(string Name, string Values)
	{
		_name = Name;
		_rgb = Values;

		//get defined color and apply rgb values
		Color color = Application.CurrentDocument.GetColor(_name);
		color.RgbValues = this.Rgb;
	}

	public override string ToString()
	{
		return _name;
	}
}

Clone this wiki locally