Package mars.settings
Class ColorSetting
java.lang.Object
mars.settings.ColorSetting
Class representing a persistent color setting and its current value.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Color
Decode aColor
object from a string containing an integer in some format.static String
Encode aColor
object as a string containing a hexadecimal integer with a leading0x
.get()
Get the value currently stored in this setting.Get the theme default value for this setting.getKey()
Get the key used to identify this setting inPreferences
.Get the value currently stored in this setting if it is notnull
, or the theme default returned bygetDefault()
otherwise.void
Set the value of this setting, updating persistent storage.void
setNonPersistent
(Color value) Set the value of this setting without updating persistent storage.void
-
Method Details
-
getKey
Get the key used to identify this setting inPreferences
.- Returns:
- The string key for this setting.
-
get
Get the value currently stored in this setting.- Returns:
- The color value for this setting.
-
set
Set the value of this setting, updating persistent storage.- Parameters:
value
- The new color value for this setting.
-
getDefault
Get the theme default value for this setting.- Returns:
- The theme default color value for this setting.
-
updateDefault
public void updateDefault() -
getOrDefault
Get the value currently stored in this setting if it is notnull
, or the theme default returned bygetDefault()
otherwise.- Returns:
- The color value for this setting, or the theme default if not set.
-
setNonPersistent
Set the value of this setting without updating persistent storage.- Parameters:
value
- The new color value for this setting.
-
encode
Encode aColor
object as a string containing a hexadecimal integer with a leading0x
.- Parameters:
color
- The color to encode as a string.- Returns:
- The encoded form of the given color.
- See Also:
-
decode
Decode aColor
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:
-