Class ThemeTokens

java.lang.Object
com.iizix.prop.ThemeTokens

public final class ThemeTokens extends Object
The platform's shape, type and motion tokens, and the decoration tokens of the buttons and the cards (CC-THEME-PALETTE), and the Switch's ON track (CC-MERGE-297-305-FOLLOWUP): the 21 custom properties beside the 37 color roles of ColorRoles that every shipped theme defines (THEME-DESIGN.md section 4.3, frozen by ruling R9) - radii, border width, shadows, spacing, fonts, font size, line height and duration. This table is the Java side of the sheet's list, kept in step with iz/css/iiziThemes.css by ThemeSheetPaletteTest as ColorRoles is.

A custom theme (AppTheme) names a token by its slug, the custom property without --iz-: r, r2, bw, sh1, sh2, sp, font, mono, fs, lh, dur, and the decoration tokens btn-t, btn-b, btn-ht, btn-hb, btn-pt, btn-pb (the button gradient at rest, hovered and pressed, top and bottom), btn-bd (the button border), sh-btn and sh-card (the button and the card shadow), and sw-on (the fill of a Switch's ON side, the dojox/mobile Switch's left track: a bright green the AccentText reads on, apart from the SuccessText role that is a TEXT colour, made dark in the light modes - row 7 of CC-MERGE-297-305-FOLLOWUP, 2026-10-25), sw-on-fg (its label; CC-FIX-SERVER-THEME-WALK), and stripe (the odd row of a table, one grey step from the WidgetBackground the table sits on - CC-FIX-THEME-LINES, 2026-10-26). Its value is CSS text, checked by check(Token,String) against the token's ThemeTokens.Kind: a lenient check that finds a typing error, not a CSS parser. A value that holds a brace, a semicolon or an angle bracket could break the generated block for every rule after it; such a value is never delivered (isSafe(String)).

Author:
Christopher Mindus
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The kind of value a token holds.
    static final record 
    A token.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final List<ThemeTokens.Token>
    The 23 tokens in the order of the sheet's vocabulary table: the shape tokens, the twelve decoration tokens (the nine of CC-THEME-PALETTE after the shadows they belong with, then the Switch's ON track and its label, then the table's odd-row stripe), then the spacing, type and motion tokens.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Checks a value against a token's kind.
    get(String slug)
    Gets a token by slug.
    static boolean
    isSafe(String value)
    Checks if a value can be written into the generated block without breaking it: no brace, semicolon, angle bracket, backslash or comment opener, quotes and parentheses balanced.
    static boolean
    Checks if a name is a token slug.
  • Field Details

    • TOKENS

      public static final List<ThemeTokens.Token> TOKENS
      The 23 tokens in the order of the sheet's vocabulary table: the shape tokens, the twelve decoration tokens (the nine of CC-THEME-PALETTE after the shadows they belong with, then the Switch's ON track and its label, then the table's odd-row stripe), then the spacing, type and motion tokens.
  • Method Details

    • get

      public static ThemeTokens.Token get(String slug)
      Gets a token by slug.
      Parameters:
      slug - The slug, case sensitive.
      Returns:
      The token, or null if the slug is not a token (also for null).
    • isToken

      public static boolean isToken(String slug)
      Checks if a name is a token slug.
      Parameters:
      slug - The name, case sensitive.
      Returns:
      true if the name is one of the 11 slugs.
    • isSafe

      public static boolean isSafe(String value)
      Checks if a value can be written into the generated block without breaking it: no brace, semicolon, angle bracket, backslash or comment opener, quotes and parentheses balanced.
      Parameters:
      value - The value.
      Returns:
      true when it is safe to deliver, false otherwise (also for null or blank).
    • check

      public static String check(ThemeTokens.Token token, String value)
      Checks a value against a token's kind.
      Parameters:
      token - The token.
      value - The CSS text.
      Returns:
      null when the value is acceptable, otherwise the reason, phrased to follow "The value ... of the token ...".