Class UISchemes

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

public class UISchemes extends Object
The catalogue 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
  • 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.
    • 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.