RSDColorMatrix

public final class RSDColorMatrix

The color matrix is a shared singleton that allows for accessing the color palettes using registered libraries that are included within the Research framework.

  • The color libraries that are registered with the Research framework. The libraries are loaded using a lazy loading. If the application receives a low memory warning, then the libraries are released from memory.

    Declaration

    Swift

    public var registeredLibraries: [RSDColorLibrary] { get }
  • The current version of the default color library.

    Declaration

    Swift

    public var currentVersion: Int { get }
  • The library for a given version.

    Declaration

    Swift

    public func library(for version: Int?) -> RSDColorLibrary

    Parameters

    version

    The version to return or nil to return the most recent.

    Return Value

    The color library for this version.

  • Get the gray scale to use for a given version of the color library.

    Declaration

    Swift

    public func grayScale(for version: Int?) -> RSDGrayScale

    Parameters

    version

    The version to return or nil to return the most recent.

    Return Value

    The gray scale for this version.

  • Get the color swatch associated with the given name.

    Declaration

    Swift

    public func colorSwatch(for name: RSDReservedColorName, version: Int?) -> RSDColorSwatch?

    Parameters

    name

    The name of the color swatch.

    version

    The version to return or nil to return the most recent.

    Return Value

    The color swatch for the given name and version.

  • Get the color swatch associated with the given name.

    Declaration

    Swift

    public func colorKey(for name: RSDReservedColorName, shade: RSDColorSwatch.Shade) -> RSDColorKey

    Parameters

    name

    The name of the color swatch.

    shade

    The shade of the color.

    Return Value

    The color key for the given name and shade.

  • Get the most appropriate color key for a given reserved color name.

    Declaration

    Swift

    public func colorKey(for name: RSDReservedColorName, version: Int? = nil, index: Int? = nil) -> RSDColorKey

    Parameters

    name

    The name of the color swatch.

    version

    The version to return or nil to return the most recent.

    index

    The index into the color swatch or nil to return the dark shade.

    Return Value

    The color key.

  • Get the most appropriate color mappinng for a gray scale color.

    Declaration

    Swift

    public func colorMapping(for gray: RSDGrayScale.Shade, version: Int? = nil) -> RSDColorMapping

    Parameters

    shade

    The shade of the color.

    version

    The version to return or nil to return the most recent.

    Return Value

    The color mapping.

  • Find a color mapping from the color. This will look through the libraries and swatches for a matching color.

    Declaration

    Swift

    public func findColorKey(for colorName: String) -> RSDColorKey?

    Parameters

    color

    The color to find.

    Return Value

    The color tile for this color, if found.

  • Find a color tile from the color. This will look through the libraries and swatches for a matching color.

    Declaration

    Swift

    public func findColorTile(for color: RSDColor) -> RSDColorTile?

    Parameters

    color

    The color to find.

    Return Value

    The color tile for this color, if found.