Enum Class Tone

java.lang.Object
java.lang.Enum<Tone>
limn.components.Tone
All Implemented Interfaces:
Serializable, Comparable<Tone>, Constable

public enum Tone extends Enum<Tone>
Which of the palette's colours a piece of text or a mark is drawn in, said by what it means rather than by the colour: a line that reports a failure is DANGER, whatever red the palette in force calls danger.

A tone is resolved when it is drawn, not when it is set. A Color read off Theme.current() while a page is built is the palette of that moment, and a change of palette afterwards (the system turning dark, the user picking another) leaves it behind; a tone is asked of the theme on every paint, so it follows. That is what Label.setTone(limn.components.Tone) gives a line of text, and what a Field draws its line under the control with.

Each tone is one of the palette's tokens, so its contrast is the palette's: the built-in palettes are tested for each as text on the canvas, on a card and on a popover.

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

  • Enum Constant Details

    • NEUTRAL

      public static final Tone NEUTRAL
      Nothing to call attention to: the palette's muted text.
    • ACCENT

      public static final Tone ACCENT
      The application's own colour: the palette's accent as text, which is Theme.primary() where that already reads as text on every surface.
    • INFO

      public static final Tone INFO
      A note: the palette's info.
    • SUCCESS

      public static final Tone SUCCESS
      Something done or accepted: the palette's success.
    • WARNING

      public static final Tone WARNING
      Something to check: the palette's warning.
    • DANGER

      public static final Tone DANGER
      Something refused or failed: the palette's danger.
  • Method Details

    • values

      public static Tone[] 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 Tone 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
    • colorIn

      public Color colorIn(Theme theme)
      The colour this tone is in theme: what a widget drawing in a tone asks, on every paint.
      Parameters:
      theme - the palette to read
      Returns:
      the colour