Table of Contents

Class FontPalette

Namespace
SixLabors.Fonts
Assembly
SixLabors.Fonts.dll

Selects the CPAL color palette used to resolve COLR glyph colors and optionally replaces individual palette entries.

A palette index outside the range defined by the font selects the default palette (index 0), and overrides still apply, matching the CSS font-palette behavior. Overrides apply in order, so a later override of the same entry replaces an earlier one, and overrides whose entry index lies outside the font's palette entry range are ignored.

public sealed class FontPalette : IEquatable<FontPalette>
Inheritance
FontPalette
Implements
Inherited Members

Constructors

FontPalette(int)

Initializes a new instance of the FontPalette class.

public FontPalette(int index)

Parameters

index int

The zero-based palette index within the font's CPAL table.

FontPalette(int, IReadOnlyList<FontPaletteOverride>)

Initializes a new instance of the FontPalette class.

public FontPalette(int index, IReadOnlyList<FontPaletteOverride> overrides)

Parameters

index int

The zero-based palette index within the font's CPAL table.

overrides IReadOnlyList<FontPaletteOverride>

The override colors to apply, in order, on top of the selected palette.

Properties

Index

Gets the zero-based palette index within the font's CPAL table.

public int Index { get; }

Property Value

int

Overrides

Gets the override colors applied, in order, on top of the selected palette.

public IReadOnlyList<FontPaletteOverride> Overrides { get; }

Property Value

IReadOnlyList<FontPaletteOverride>

Methods

Equals(FontPalette?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(FontPalette? other)

Parameters

other FontPalette

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.