Class AccentColor

java.lang.Object
io.github.jbastgen.stemma.app.theme.AccentColor

public final class AccentColor extends Object
The accent colour (feature 15): the orange of highlights, selected rows, primary buttons and links, which the user can replace. From one colour the tokens of the theme are derived (hover, soft and faint tints, the text colour on it), and the colour is moved lighter or darker until it can be read against the background of the chosen theme.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    The least contrast (WCAG ratio) an accent must have with the background of its theme.
    static final String[][]
    The colours offered in the settings: name and hex.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Optional<int[]>
    adjusted(String hex, Theme theme)
    The colour as it is used in the theme: the chosen one, darker (light theme) or lighter (dark theme) if its contrast is too low.
    static double
    contrastOf(String hex, Theme theme)
    The contrast the colour as chosen has with the background of the theme (before any adjustment).
    static String
    hex(int[] c)
    The colour as #RRGGBB.
    static Optional<int[]>
    parse(String text)
    #rrggbb (also rrggbb and #rgb) as three numbers; empty if it is none.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MIN_CONTRAST

      public static final double MIN_CONTRAST
      The least contrast (WCAG ratio) an accent must have with the background of its theme.
      See Also:
    • PALETTE

      public static final String[][] PALETTE
      The colours offered in the settings: name and hex.
  • Method Details

    • parse

      public static Optional<int[]> parse(String text)
      #rrggbb (also rrggbb and #rgb) as three numbers; empty if it is none.
    • hex

      public static String hex(int[] c)
      The colour as #RRGGBB.
    • contrastOf

      public static double contrastOf(String hex, Theme theme)
      The contrast the colour as chosen has with the background of the theme (before any adjustment).
    • adjusted

      public static Optional<int[]> adjusted(String hex, Theme theme)
      The colour as it is used in the theme: the chosen one, darker (light theme) or lighter (dark theme) if its contrast is too low.