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.

A 1.x minor release may add constants to this enum: a switch over it needs a default branch.

  • Enum Constant Details

    • BACKGROUND

      public static final Theme.Token BACKGROUND
      Theme.background: the canvas a window clears to.
    • SURFACE

      public static final Theme.Token SURFACE
      Theme.surface: a card, a field, a panel on the canvas.
    • SURFACE_RAISED

      public static final Theme.Token SURFACE_RAISED
      Theme.surfaceRaised: a popover, a menu, a dialog above a surface.
    • PRIMARY

      public static final Theme.Token PRIMARY
      Theme.primary: the accent, at rest.
    • PRIMARY_HOVER

      public static final Theme.Token PRIMARY_HOVER
      Theme.primaryHover: the accent under the pointer.
    • PRIMARY_PRESSED

      public static final Theme.Token PRIMARY_PRESSED
      Theme.primaryPressed: the accent while held.
    • ON_PRIMARY

      public static final Theme.Token ON_PRIMARY
      Theme.onPrimary: the label on an accent fill.
    • TEXT

      public static final Theme.Token TEXT
      Theme.text: body ink.
    • TEXT_MUTED

      public static final Theme.Token TEXT_MUTED
      Theme.textMuted: secondary ink; still body text, still 4.5:1.
    • OUTLINE

      public static final Theme.Token OUTLINE
      Theme.outline: borders and separators.
    • FOCUS_RING

      public static final Theme.Token FOCUS_RING
      Theme.focusRing: the ring around the focused control.
    • DISABLED_FILL

      public static final Theme.Token DISABLED_FILL
      Theme.disabledFill: the fill of a control that cannot be used.
    • DISABLED_TEXT

      public static final Theme.Token DISABLED_TEXT
      Theme.disabledText: its label.
    • SCRIM

      public static final Theme.Token SCRIM
      Theme.scrim: the veil under a modal, and the one tone with an alpha.
    • DANGER

      public static final Theme.Token DANGER
      Theme.danger: error and destructive.
    • SUCCESS

      public static final Theme.Token SUCCESS
      Theme.success: success and valid.
    • WARNING

      public static final Theme.Token WARNING
      Theme.warning: warning and caution.
    • INFO

      public static final Theme.Token INFO
      Theme.info: informational.
  • 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 @Nullable Theme.Token byKey(String key)
      Returns:
      the token whose key() is key, or null if none is