Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class CSSThemeCompiler

  1. Object
  2. CSSThemeCompiler

Compiles a subset of Codename One CSS into theme properties stored in a MutableResource.

Supported selector syntax

  • UIID
  • UIID:selected
  • UIID:pressed
  • UIID:disabled
  • UIID:hover
  • * (mapped to Component)
  • :root (for constants only)

Supported declarations

  • color
  • background-color
  • padding, margin: one to four values in CSS top/right/bottom/left order, stored in the theme’s top/bottom/left/right order together with per-side padUnit/marUnit metadata. px, pt and unitless values are pixels (rounded, as the build-time compiler does), mm and cm are millimetres, and rem, vw, vh, vmin, vmax keep their own unit. A percentage is rejected, as the build-time compiler rejects it.
  • font-family and font-size: resolved to a Font with the build-time compiler’s semantics. The family defaults to native:MainRegular and the size to the medium system font; font-size accepts px, pt, mm, cm, in, rem, vw, vh, vmin, vmax, % and the small/medium/large keywords.
  • cn1-derive
  • cn1-image-id
  • cn1-mutable-image
  • border-related properties: border, border-*, background-image, background-position, background-repeat

Theme constants

  • CSS custom property definitions in :root, e.g. --primary: #ff00ff;
  • #Constants { name: value; }, the block the build-time compiler reads, and the older @constants { name: value; other: value; } spelling.
  • var(--name) dereferencing in declaration values.

A constant keeps the case of its name (includeNativeBool becomes @includeNativeBool) and a quoted value is stored without its quotes, so 'true' and "true" both become true.

Nested types

class CSSThemeCompiler.CSSSyntaxException

Constructors

public CSSThemeCompiler()

Methods

public void compile(String css, MutableResource resources, String themeName)

Inherited methods

Constructor details

CSSThemeCompiler

public CSSThemeCompiler()

Method details

compile

public void compile(String css, MutableResource resources, String themeName)