Table of Contents

Struct ColorSettings

Namespace
TinyLife.Utilities
Assembly
Tiny Life.dll

Color settings are a collection of color schemes that can be used to color an object. They also contain a mapping of which layers should use which color schemes, and a set of default color schemes. Color settings are most notably used by FurnitureType.TypeSettings, as well as other objects in the world.

public struct ColorSettings
Inherited Members
Extension Methods

Constructors

ColorSettings(params ColorScheme[])

Creates a new color settings instance with the given color schemes.

public ColorSettings(params ColorScheme[] schemes)

Parameters

schemes ColorScheme[]

The color schemes to use.

Fields

Defaults

The default color selection for these settings, where the i-th value represents color index to use in the i-th Schemes entry. If not specified, this defaults to the indices of the first entries in each of the Schemes. This array is expected to have the same length as Schemes.

public int[] Defaults

Field Value

int[]

Map

An array of indices that determines which layers should use which color schemes. An object that uses ColorSettings will always have the same amount of texture layers as there are color map entries.

public int[] Map

Field Value

int[]

Modifiers

An array of colors that should be multiplied with the colors from this color settings' Schemes. The i-th Schemes entry's colors will be multiplied with the i-th entry in this array.

public Color[] Modifiers

Field Value

Color[]

PreviewModifiers

An array of colors that should be multiplied with the colors from this color settings' Schemes, but only when they are being displayed in the ColorSelection(ColorSettings, Action<int, int>, Func<int, int, bool>) menu. If this is null, the regular Modifiers are used. The i-th Schemes entry's colors will be multiplied with the i-th entry in this array.

public Color[] PreviewModifiers

Field Value

Color[]

PreviewName

A name that should be used when these color settings are displayed in the ColorSelection(ColorSettings, Action<int, int>, Func<int, int, bool>) menu to distinguish the color schemes used in these settings.

public string PreviewName

Field Value

string

Schemes

An array of color schemes that these settings should have. If Map is not set, its value is determined automatically by the amount of color schemes supplied.

public ColorScheme[] Schemes

Field Value

ColorScheme[]

Methods

CreateRandom(Random)

Creates a random set of colors based on these color settings and the passed Random instance.

public readonly int[] CreateRandom(Random random)

Parameters

random Random

The random instance to use.

Returns

int[]

The generated colors.

Get(int[], int)

Returns the color that should be used for the given layer, based on the given color selections.

public readonly Color Get(int[] colors, int layer)

Parameters

colors int[]

The color selections.

layer int

The layer.

Returns

Color

The color to use.

Validate(ref int[])

Validates these color settings and the passed colors, ensuring that the given color selections are within the bounds of the available color schemes.

public readonly void Validate(ref int[] colors)

Parameters

colors int[]

The color selections.