New to Telerik Document ProcessingStart a free 30-day trial

Colors and Color Spaces

Updated on May 11, 2026

The ColorBase abstract class is used to encapsulate colors in different color spaces. The classes which inherit from ColorBase are:

SimpleColor

The simple colors represent colors, which are defined with color components. The following colors are categorized as simple:

RgbColor

Represents an ARGB (alpha, red, green, blue) color. The RgbColor class exposes the following properties:

PropertyDescription
AThe alpha component value.
RThe red component value.
GThe green component value.
BThe blue component value.

Example 1 demonstrates how you can create an RgbColor and assign it as Fill of a Path element.

Example 1: Create RgbColor

C#
RgbColor magenta = new RgbColor(255, 0, 255);
Telerik.Windows.Documents.Fixed.Model.Graphics.Path path = new Telerik.Windows.Documents.Fixed.Model.Graphics.Path();
path.Fill = magenta;

CmykColor

Represents a CMYK (cyan, magenta, yellow, key) color. The CmykColor class was introduced in Q4 2024 and it exposes the following properties:

PropertyDescription
CThe cyan component of the color, a value between 0.0 and 1.0.
MThe magenta component of the color, a value between 0.0 and 1.0.
YThe yellow component of the color, a value between 0.0 and 1.0.
KThe key (black) component of the color, a value between 0.0 and 1.0.

Create CmykColor

C#
RadFixedDocument document = new RadFixedDocument();
RadFixedPage page = document.Pages.AddPage();
FixedContentEditor containerEditor = new FixedContentEditor(page);

double c = 0.46;
double m = 0.3;
double y = 0.76;
double k = 0.12;

CmykColor cmykColor = new CmykColor(c, m, y, k);
containerEditor.GraphicProperties.FillColor = cmykColor;
containerEditor.DrawRectangle(new Rect(10, 10, 48, 29));

CMYK Color

The difference between the RGB and CMYK color spaces is an essential aspect of color management in the design industry. While CMYK is used for traditional print, the RGB color space is used for screen-based media.

PatternColor

The abstract PatternColor class represents colors, which are defined with the pattern color space. A pattern color paints with a pattern rather than a single color. PatternColor is inherited by the Gradient and TilingBase classes.

Gradient

Gradient provides a smooth transition between colors across an area which is painted. The gradient color is represented by the Gradient abstract class which exposes the following properties:

PropertyDescription
StartPointA Point object representing the starting two-dimensional coordinates of the gradient.
EndPointA Point object representing the ending two-dimensional coordinates of the gradient.
ExtendBeforeSpecifies whether to extend the gradient beyond the starting point.
ExtendAfterSpecifies whether to extend the gradient beyond the ending point.
BackgroundA SimpleColor object representing the background color.
GradientStopsA collection of GradientStop objects representing the gradient stops.

The Gradient class is inherited by the following classes:

  • LinearGradient: Defines a color blend along a line between two points, optionally extended beyond the boundary points by continuing the boundary colors.

    Example 2 shows how to create a LinearGradient and assign it as the FillColor of a FixedContentEditor.

    Example 2: Create LinearGradient

    C#
    FixedContentEditor containerEditor = new FixedContentEditor(container);
            
    LinearGradient linearGradient = new LinearGradient(new Point(0, 0), new Point(30, 30));
    linearGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 207, 0), 0));
    linearGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 102, 204), 1));
    
    containerEditor.GraphicProperties.FillColor = linearGradient;
    containerEditor.DrawRectangle(new Rect(10, 10, 48, 29));

The gradient created in Example 2 is shown in Figure 1.

Figure 1: LinearGradient

Rad Pdf Processing Concepts Colors And Color Spaces 01

  • RadialGradient: Defines a blend between two circles, optionally extended beyond the boundary circles by continuing the boundary colors. The RadialGradient class exposes the following additional properties:
PropertyDescription
StartRadiusDecimal number determining the radius of the starting circle.
EndRadiusDecimal number determining the radius of the ending circle.

Example 3 demonstrates how to create a RadialGradient and assing it as the FillColor of a FixedContentEditor.

Example 3: Create RadialGradient

C#
FixedContentEditor containerEditor = new FixedContentEditor(container);
        
LinearGradient linearGradient = new LinearGradient(new Point(0, 0), new Point(30, 30));
linearGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 207, 0), 0));
linearGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 102, 204), 1));

containerEditor.GraphicProperties.FillColor = linearGradient;
containerEditor.DrawRectangle(new Rect(10, 10, 48, 29));

The result from Example 3 is shown in Figure 2.

Figure 2: RadialGradient

Rad Pdf Processing Concepts Colors And Color Spaces 03

Tiling Pattern

A tiling pattern consists of a small graphical figure called a pattern cell. Painting with the pattern replicates the cell at fixed horizontal and vertical intervals to fill an area. The tiling pattern is represented by the TilingBase abstract class, which exposes the following properties:

PropertyDescription
BoundingBoxOf type Rect, representing the dimensions of the pattern cell.
VerticalSpacingDecimal number determining the vertical spacing between pattern cells.
HorizontalSpacingDecimal number determining the horizontal spacing between pattern cells.
SizeThe size of the bounding box.
ContentThe collection of content elements inside a pattern cell.
PositionThe position of the tiling pattern.
TilingTypeOf type TilingType, represents the tiling type. Possible values: AllowSmallDistortion (cells spaced consistently with slight distortion), NoDistortion (cells not distorted but spacing may vary), FastTiling (consistent spacing with additional distortion for efficient painting).

The TilingBase class is inherited from the following classes:

  • Tiling: Represents a tiling pattern.

  • UncoloredTiling: Represents an uncolored tiling pattern. This type of tiling patterns can be defined with some specific content, and then reused with a different color of their content. It exposes two additional properties - Tiling which represents the tiling to be used and Color representing the color of the content of the specified tiling.

Since the TilingBase class implements the IContentRootElement interface like RadFixedPage, the content of the tiling can be modified using the FixedContentEditor class. Example 4 shows how a tiling pattern can be created.

Example 4: Create tiling

C#
FixedContentEditor containerEditor = new FixedContentEditor(container);

Tiling tiling = new Tiling(new Rect(0, 0, 10, 10));
FixedContentEditor tilingEditor = new FixedContentEditor(tiling);
tilingEditor.GraphicProperties.IsStroked = false;
tilingEditor.GraphicProperties.FillColor = new RgbColor(128, 28, 43);
tilingEditor.DrawRectangle(new Rect(2, 2, 5, 7));

containerEditor.GraphicProperties.FillColor = tiling;
containerEditor.DrawCircle(new Point(30, 30), 20);

The tiling created in Example 4 is shown in Figure 3.

Figure 3: Tiling

Rad Pdf Processing Concepts Colors And Color Spaces 02

LabColor

LAB is a device-independent color space: L represents lightness or brightness, A represents the red-green axis, and B represents the yellow-blue axis.

Create LabColor

C#
double[] whitePoint = new double[3] { 1, 2, 3 };
double[] range = new double[4] { 4, 5, 6, 7 };
double[] expectedBlackPoint = new double[3] { 0, 0, 0 };

LabColor labColor = new LabColor(1, 2, 3, whitePoint, range);

See Also