Table of Contents

Class ColorPalette

Namespace
Tudormobile.Wpf.Controls
Assembly
Tudormobile.WpfControls.dll

Represents a themed color palette with utility methods for creating brushes and gradients.

public class ColorPalette
Inheritance
ColorPalette
Inherited Members

Remarks

The ColorPalette class provides a convenient way to work with predefined color themes. Each palette contains six harmonious colors ranging from light to dark, and offers factory methods for creating solid brushes, linear gradients, and radial gradients. Static instances are provided for quick access to common color themes.

Constructors

ColorPalette(ColorGroup)

Initializes a new instance of the ColorPalette class with the specified color group.

public ColorPalette(ColorPalette.ColorGroup group)

Parameters

group ColorPalette.ColorGroup

The color group theme for this palette.

Properties

Aquamarine

Gets a static instance of the Aquamarine color palette.

public static ColorPalette Aquamarine { get; }

Property Value

ColorPalette

Blue

Gets a static instance of the Blue color palette.

public static ColorPalette Blue { get; }

Property Value

ColorPalette

Brushes

Gets an array of solid color brushes created from the palette colors.

public Brush[] Brushes { get; }

Property Value

Brush[]

Remarks

The brushes are lazily initialized and cached for performance. Each brush corresponds to a color in the Colors array.

Colors

Gets the array of colors in this palette.

public Color[] Colors { get; }

Property Value

Color[]

Remarks

Returns six colors ranging from the primary color through various shades to the darkest color. The color order is: primary, lightest, light-medium, medium-dark, dark, darkest.

DarkThemeTextBrush

Gets the recommended text brush for dark theme backgrounds.

public Brush DarkThemeTextBrush { get; }

Property Value

Brush

Remarks

Returns the lightest color in the palette, which provides good contrast on dark backgrounds.

DarkestColor

Gets the darkest color in the palette.

public Color DarkestColor { get; }

Property Value

Color

Remarks

Useful for shadows, text on light backgrounds, or creating depth in UI elements.

Green

Gets a static instance of the Green color palette.

public static ColorPalette Green { get; }

Property Value

ColorPalette

Group

Gets the color group theme associated with this palette.

public ColorPalette.ColorGroup Group { get; }

Property Value

ColorPalette.ColorGroup

HorizontalBrush

Gets a cached horizontal linear gradient brush.

public LinearGradientBrush HorizontalBrush { get; }

Property Value

LinearGradientBrush

Remarks

The brush is lazily initialized and reused for performance. Transitions from light (left) to dark (right).

LightThemeTextBrush

Gets the recommended text brush for light theme backgrounds.

public Brush LightThemeTextBrush { get; }

Property Value

Brush

Remarks

Returns the darkest color in the palette, which provides good contrast on light backgrounds.

LightestColor

Gets the lightest color in the palette.

public Color LightestColor { get; }

Property Value

Color

Remarks

Useful for highlights, text on dark backgrounds, or creating subtle backgrounds.

Orange

Gets a static instance of the Orange color palette.

public static ColorPalette Orange { get; }

Property Value

ColorPalette

PrimaryBrush

Gets the primary solid brush for this palette (the first color in the group).

public Brush PrimaryBrush { get; }

Property Value

Brush

Remarks

This is typically the most representative color of the theme and is suitable for primary UI elements.

PrimaryColor

Gets the primary color for this palette (the first color in the group).

public Color PrimaryColor { get; }

Property Value

Color

Purple

Gets a static instance of the Purple color palette.

public static ColorPalette Purple { get; }

Property Value

ColorPalette

RadialBrush

Gets a cached radial gradient brush with light center to dark edges.

public RadialGradientBrush RadialBrush { get; }

Property Value

RadialGradientBrush

Remarks

The brush is lazily initialized and reused for performance.

ReversedRadialBrush

Gets a cached radial gradient brush with dark center to light edges.

public RadialGradientBrush ReversedRadialBrush { get; }

Property Value

RadialGradientBrush

Remarks

The brush is lazily initialized and reused for performance. Useful for spotlight or vignette effects.

Rose

Gets a static instance of the Rose color palette.

public static ColorPalette Rose { get; }

Property Value

ColorPalette

Tan

Gets a static instance of the Tan color palette.

public static ColorPalette Tan { get; }

Property Value

ColorPalette

VerticalBrush

Gets a cached vertical linear gradient brush.

public LinearGradientBrush VerticalBrush { get; }

Property Value

LinearGradientBrush

Remarks

The brush is lazily initialized and reused for performance. Transitions from light (top) to dark (bottom).

Methods

CreateGradientBrush(double)

Creates a linear gradient brush with the specified angle.

public LinearGradientBrush CreateGradientBrush(double angle = 0)

Parameters

angle double

The angle of the gradient in degrees. Default is 0 (left to right).

Returns

LinearGradientBrush

A LinearGradientBrush transitioning from the lightest to darkest color.

Remarks

The gradient transitions from LightestColor to DarkestColor. Common angles: 0 (horizontal left-right), 90 (vertical top-bottom), 45 (diagonal).

CreateHorizontalGradientBrush()

Creates a horizontal linear gradient brush (left to right).

public LinearGradientBrush CreateHorizontalGradientBrush()

Returns

LinearGradientBrush

A LinearGradientBrush with 0-degree angle.

CreateRadialGradientBrush(bool)

Creates a radial gradient brush.

public RadialGradientBrush CreateRadialGradientBrush(bool isReversed = false)

Parameters

isReversed bool

If true, gradient goes from dark center to light edges; otherwise light center to dark edges.

Returns

RadialGradientBrush

A RadialGradientBrush with the specified direction.

Remarks

By default, the gradient radiates from a light center to dark edges. Set isReversed to true for a dark center radiating to light edges.

CreateVerticalGradientBrush()

Creates a vertical linear gradient brush (top to bottom).

public LinearGradientBrush CreateVerticalGradientBrush()

Returns

LinearGradientBrush

A LinearGradientBrush with 90-degree angle.