Class UISchemes

java.lang.Object
com.iizix.prop.ui.device.UISchemes

public class UISchemes extends Object
The catalog of the shipped theme schemes: the theme families with a light and a dark member, defined as values of the platform tokens in iz/css/iiziThemes.css (THEME-DESIGN.md sections 3.2, 4.5 and 4.6, order CC-THEME-A1-TOKENS).

The CSS is the source of truth; this class lists the family names for the Designer's "Theme and Client" menu and for validation of what a client reports. Every name is new and never one of the Dojo widget style names of UIThemes.Name (flat, dbootstrap, ios7) nor a removed one (claro and the others), so that an old name always means the old theme (ruled 2026-09-25). ThemeSheetTest in com.iizix.js.tests keeps this list, the sheet and iz/uischeme.js in step.

A scheme travels as the string "family/mode": in the $scheme client property (ClientProps.setUIScheme(String)), in the uiScheme environment property a client reports (EnvProps.getUIScheme()) and in a Browser's storage. The client resolves auto itself; a reported scheme is never auto. The CHOICE, auto included, is reported beside it in uiSchemeChoice (EnvProps.getUISchemeChoice()), and an application sets both halves from Java through IClientSessionGyro.setUIScheme (order CC-THEME-DARK-V5).

The modes auto and auto_light are one mode, auto with light as the fallback when the system cannot tell; auto_dark is auto with dark as the fallback. A page shows dark only when the application allows it: applyModesMarker(String,int) writes the application's allowed modes into the page's first-paint lines, and the $schemeModes client property (ClientProps.setUISchemeModes(String)) tells a connected client the same.

Author:
Christopher Mindus
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The shipped theme families (ruling R7): IIZI, Graphite and Contrast.
    static enum 
    The modes: light, dark, or auto that follows the OS (ruled Q6, R6).
    static final record 
    A scheme: a family and a mode.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The attribute on the document element that carries the resolved mode.
    static final String
    The attribute on the document element that carries the modes the application allows, set by the first-paint lines of the page from MODES_MARKER: light, dark, or absent for both.
    static final String
    The attribute on the document element that carries the family.
    static final UISchemes.Family
    The default family: IIZI.
    static final String
    The name of the string property under the environment properties in which a client reports the scheme it shows.
    static final String
    The name of the string property under the environment properties in which a client reports the scheme it was told to show, the mode as chosen: light, dark, auto or auto_dark.
    static final int
    The value of an application's allowed modes meaning both, light and dark: the default.
    static final int
    The value of an application's allowed modes meaning dark only.
    static final int
    The value of an application's allowed modes meaning light only.
    static final String
    The marker in iiziApp.html the server replaces, per application, by the modes the application allows (modesValue(int)), or by nothing: "%%MODES%%".
    static final char
    The separator between the family and the mode in the string form.
    static final String
    The shipped sheet, relative to the web root.
    static final String
    The key under which a Browser keeps the choice in its storage.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    allows(int modes, UISchemes.Mode mode)
    Checks if an application's allowed modes let a mode be chosen: every mode when the application allows both, the pinned mode alone when it allows one - an auto mode is then not offered, as it would resolve to the pinned mode in any case.
    static String
    applyModesMarker(String html, int modes)
    Replaces the MODES_MARKER of a page by an application's allowed modes.
    static String
    Replaces the MODES_MARKER of a page by an application's allowed modes, given as the value modesValue(int) produces.
    static String
    modesValue(int modes)
    Gets the value the client reads for an application's allowed modes, in the page's MODES_MARKER and in the $schemeModes property.
    static String
    openingMode(int modes, String chosen)
    Gets the mode a Designer page opens a panel in (order CC-THEME-MODES-DESIGNER-V51): the mode the panel's application pins, else the mode chosen.
    Parses a scheme string.
    Parses a mode string: a mode alone, as the theme URL parameter and the API carry it.
    pinnedMode(int modes)
    Gets the mode an application's allowed modes pin a page to (order CC-THEME-MODES-DESIGNER-V51): an application that allows one mode shows that mode whatever is chosen - the client resolves every choice to it (iz/uischeme.js), and the Panel Editor and the Design Viewer open a panel of such an application in it.
    static String
    Formats a scheme string.
  • Field Details

    • DEFAULT_FAMILY

      public static final UISchemes.Family DEFAULT_FAMILY
      The default family: IIZI.
    • SEPARATOR

      public static final char SEPARATOR
      The separator between the family and the mode in the string form.
      See Also:
    • SHEET

      public static final String SHEET
      The shipped sheet, relative to the web root.
      See Also:
    • ATTR_SCHEME

      public static final String ATTR_SCHEME
      The attribute on the document element that carries the family.
      See Also:
    • ATTR_MODE

      public static final String ATTR_MODE
      The attribute on the document element that carries the resolved mode.
      See Also:
    • ENV_PROP

      public static final String ENV_PROP
      The name of the string property under the environment properties in which a client reports the scheme it shows.
      See Also:
    • STORAGE_KEY

      public static final String STORAGE_KEY
      The key under which a Browser keeps the choice in its storage.
      See Also:
    • ENV_PROP_CHOICE

      public static final String ENV_PROP_CHOICE
      The name of the string property under the environment properties in which a client reports the scheme it was told to show, the mode as chosen: light, dark, auto or auto_dark.
      See Also:
    • ATTR_MODES

      public static final String ATTR_MODES
      The attribute on the document element that carries the modes the application allows, set by the first-paint lines of the page from MODES_MARKER: light, dark, or absent for both.
      See Also:
    • MODES_MARKER

      public static final String MODES_MARKER
      The marker in iiziApp.html the server replaces, per application, by the modes the application allows (modesValue(int)), or by nothing: "%%MODES%%". A copy served without the server keeps the marker, which the page reads as "both".
      See Also:
    • MODES_BOTH

      public static final int MODES_BOTH
      The value of an application's allowed modes meaning both, light and dark: the default.
      See Also:
    • MODES_LIGHT

      public static final int MODES_LIGHT
      The value of an application's allowed modes meaning light only.
      See Also:
    • MODES_DARK

      public static final int MODES_DARK
      The value of an application's allowed modes meaning dark only.
      See Also:
  • Constructor Details

    • UISchemes

      public UISchemes()
  • Method Details

    • parse

      public static UISchemes.Scheme parse(String s)
      Parses a scheme string.
      Parameters:
      s - The scheme as "family/mode", or null.
      Returns:
      The scheme, or null when the string is null, or names an unknown family or mode, or carries no mode.
    • parseMode

      public static UISchemes.Mode parseMode(String s)
      Parses a mode string: a mode alone, as the theme URL parameter and the API carry it.
      Parameters:
      s - The mode name, auto_light included, or null.
      Returns:
      The mode, or null when the string is null or names no mode.
    • toString

      public static String toString(UISchemes.Family family, UISchemes.Mode mode)
      Formats a scheme string.
      Parameters:
      family - The family.
      mode - The mode.
      Returns:
      The scheme as "family/mode".
    • modesValue

      public static String modesValue(int modes)
      Gets the value the client reads for an application's allowed modes, in the page's MODES_MARKER and in the $schemeModes property.
      Parameters:
      modes - MODES_BOTH, MODES_LIGHT or MODES_DARK; any other value counts as both.
      Returns:
      "light", "dark" or the empty string for both.
    • pinnedMode

      public static UISchemes.Mode pinnedMode(int modes)
      Gets the mode an application's allowed modes pin a page to (order CC-THEME-MODES-DESIGNER-V51): an application that allows one mode shows that mode whatever is chosen - the client resolves every choice to it (iz/uischeme.js), and the Panel Editor and the Design Viewer open a panel of such an application in it.
      Parameters:
      modes - MODES_BOTH, MODES_LIGHT or MODES_DARK; any other value counts as both.
      Returns:
      UISchemes.Mode.LIGHT or UISchemes.Mode.DARK for an application that allows one mode, or null when it allows both.
    • allows

      public static boolean allows(int modes, UISchemes.Mode mode)
      Checks if an application's allowed modes let a mode be chosen: every mode when the application allows both, the pinned mode alone when it allows one - an auto mode is then not offered, as it would resolve to the pinned mode in any case.
      Parameters:
      modes - MODES_BOTH, MODES_LIGHT or MODES_DARK; any other value counts as both.
      mode - The mode asked for.
      Returns:
      true when the mode may be chosen for the application.
    • openingMode

      public static String openingMode(int modes, String chosen)
      Gets the mode a Designer page opens a panel in (order CC-THEME-MODES-DESIGNER-V51): the mode the panel's application pins, else the mode chosen.
      Parameters:
      modes - The modes the panel's application allows, MODES_BOTH, MODES_LIGHT or MODES_DARK; any other value counts as both.
      chosen - The mode chosen (the Panel Editor's saved choice, a Design Viewer's URL), by name; an unknown name or null counts as light.
      Returns:
      The name of the mode to open in: the pinned mode's, else the chosen one.
    • applyModesMarker

      public static String applyModesMarker(String html, int modes)
      Replaces the MODES_MARKER of a page by an application's allowed modes.
      Parameters:
      html - The page.
      modes - The allowed modes, as modesValue(int) reads them.
      Returns:
      The page, unchanged when it carries no marker.
    • applyModesMarker

      public static String applyModesMarker(String html, String modes)
      Replaces the MODES_MARKER of a page by an application's allowed modes, given as the value modesValue(int) produces.
      Parameters:
      html - The page.
      modes - "light", "dark", or the empty string or null for both; any other value counts as both.
      Returns:
      The page, unchanged when it carries no marker.