Enum Class Theme.Token

java.lang.Object
java.lang.Enum<Theme.Token>
limn.components.Theme.Token
All Implemented Interfaces:
Serializable, Comparable<Theme.Token>, Constable
Enclosing class:
Theme

public static enum Theme.Token extends Enum<Theme.Token>
Every colour a palette is made of, as values, so that code which has to treat every tone alike (a serializer, an editor, a contrast report) enumerates them instead of naming them all and getting all but one right.

The order is the one a palette is reasoned about in: the surfaces it is built on, then the accent, then the ink, then the states, then the semantic four. It is stable, and a serialized palette's key order follows it.

  • Enum Constant Details

  • Method Details

    • values

      public static Theme.Token[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Theme.Token valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • key

      public String key()
      The stable identifier, spelled exactly like the Theme field it names: what a serialized palette writes and what an editor keys its rows by. Unlike Enum.name(), it is API: renaming it would orphan every saved palette.
    • read

      public Color read(Theme theme)
      This tone, read off theme.
    • read

      public Color read(Theme.Builder builder)
      This tone, as builder currently holds it, before any build().
    • write

      public Theme.Builder write(Theme.Builder builder, Color color)
      Sets this tone on builder, and returns that builder for chaining.
    • byKey

      public static Theme.Token byKey(String key)
      Returns:
      the token whose key() is key, or null if none is