• Manual
  • Scripting API
Show / Hide Table of Contents
  • BinaryCharm.SemanticColorPalette
    • SCP_ColorId
    • SCP_IPaletteCore
    • SCP_Palette
    • SCP_Palette.eType
    • SCP_PaletteProvider
  • BinaryCharm.SemanticColorPalette.Colorers
    • SCP_AColorer
    • SCP_AColorer<T>
    • SCP_AColorerBase
    • SCP_AGradientColorer
    • SCP_AGraphicColorer
    • SCP_AMaterialColorer
    • SCP_AMaterialColorer<T>
    • SCP_AMaterialColorerBase
    • SCP_IColorer
    • SCP_IColorer<T>
    • SCP_IGradientAccessor
    • SCP_MaterialColorDef
  • BinaryCharm.SemanticColorPalette.Importers
    • SCP_AcoPaletteData
    • SCP_AndroidXmlPaletteData
    • SCP_APaletteData
    • SCP_AsePaletteData
    • SCP_GimpPaletteData
    • SCP_IPaletteDataProvider
    • SCP_KritaPaletteData
    • SCP_SvgPaletteData
  • BinaryCharm.SemanticColorPalette.Utils
    • SCP_ColorUtils
    • SCP_ImportUtils
    • SCP_Utils

Class SCP_Utils

Static utility class acting on Palettes, offering methods related to data persistence and exchange.

Inheritance
Object
SCP_Utils
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: BinaryCharm.SemanticColorPalette.Utils
Assembly: cs.temp.dll.dll
Syntax
public static class SCP_Utils

Methods

ExtractColorDefs(SCP_Palette)

Extracts the color definitions data from a @SCP_Palette, as a dictionary of string -> Color pairs.

Declaration
public static Dictionary<string, Color> ExtractColorDefs(SCP_Palette rPalette)
Parameters
Type Name Description
SCP_Palette rPalette

The input @SCP_Palette

Returns
Type Description
Dictionary<String, Color>

A dictionary of the palette color definitions

LoadPalette(String)

Loads a @SCP_Palette from a JSON file previously saved with @BinaryCharm.SemanticColorPalette.Utils.SCP_Utils.SavePalette

Declaration
public static SCP_Palette LoadPalette(string sFilePath)
Parameters
Type Name Description
String sFilePath

The path of the JSON file to load.

Returns
Type Description
SCP_Palette

The @SCP_Palette represented by the JSON file.

SavePalette(SCP_Palette, String)

Saves rPalette to a JSON file at path sFilePath, overwriting if it already exists.

Declaration
public static void SavePalette(SCP_Palette rPalette, string sFilePath)
Parameters
Type Name Description
SCP_Palette rPalette

A @SCP_Palette to save.

String sFilePath

The destination path for the file to be written.

UpdateColorDefs(SCP_Palette, Dictionary<String, Color>)

Utility method that overwrites the color definitions of a @SCP_Palette by the definitions passed in input as a string -> Color dictionary.

Declaration
public static void UpdateColorDefs(SCP_Palette rPalette, Dictionary<string, Color> rColorDefs)
Parameters
Type Name Description
SCP_Palette rPalette

The input @SCP_Palette

Dictionary<String, Color> rColorDefs
Remarks

The method only overwrites the color definitions for which rPalette has a matching identifier. So, the overwrite can be partial, which can be useful if you want to "patch" only some colors, or if you are overwriting a palette with external data saved in the past (before new definitions were added to the palette). In casse of a partial overwrite, throws an exception - if a partial update is expected/desired, catch it.

In This Article
Back to top Binary Charm