ThemeDSL

class ThemeDSL

DSL (Domain Specific Language) helper functions for building Themes.

Adds syntax to define top-level rules in the form :

SELECTOR { ... }

Where SELECTOR is either a String, a WithPseudoStyle or a Selector.

... is a block of code with a RuleDSL as the receiver.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
operator fun String.invoke(block: RuleDSL.() -> Unit): RuleDSL

Allows a string to be used as a selector for a rule. The type of selector depends on the string's contents. If it begins with a colon, then it uses PseudoStyleSelector, otherwise it uses StyleSelector. e.g.

operator fun WithPseudoStyle.invoke(block: RuleDSL.() -> Unit): RuleDSL

Allows us to use enums (which implement WithPseudoStyle) as selectors. e.g.

operator fun Selector.invoke(block: RuleDSL.() -> Unit): RuleDSL

For example :