Package mars.settings

Class ColorSetting

java.lang.Object
mars.settings.ColorSetting

public class ColorSetting extends Object
Class representing a persistent color setting and its current value.
  • Method Details

    • getKey

      public String getKey()
      Get the key used to identify this setting in Preferences.
      Returns:
      The string key for this setting.
    • get

      public Color get()
      Get the value currently stored in this setting.
      Returns:
      The color value for this setting.
    • set

      public void set(Color value)
      Set the value of this setting, updating persistent storage.
      Parameters:
      value - The new color value for this setting.
    • getDefault

      public Color getDefault()
      Get the theme default value for this setting.
      Returns:
      The theme default color value for this setting.
    • updateDefault

      public void updateDefault()
    • getOrDefault

      public Color getOrDefault()
      Get the value currently stored in this setting if it is not null, or the theme default returned by getDefault() otherwise.
      Returns:
      The color value for this setting, or the theme default if not set.
    • setNonPersistent

      public void setNonPersistent(Color value)
      Set the value of this setting without updating persistent storage.
      Parameters:
      value - The new color value for this setting.
    • encode

      public static String encode(Color color)
      Encode a Color object as a string containing a hexadecimal integer with a leading 0x.
      Parameters:
      color - The color to encode as a string.
      Returns:
      The encoded form of the given color.
      See Also:
    • decode

      public static Color decode(String string)
      Decode a Color object from a string containing an integer in some format.
      Parameters:
      string - The string to decode as a color.
      Returns:
      The color decoded from the given string, or null if it could not be decoded.
      See Also: