BackgroundContext

class BackgroundContext(styleParams: StyleParams, target: StringBuilder) : StyleParams

This context class enables the definition of background related styling facilities.

It provides topic oriented functions to set properties directly and in some cases offers functions to enter sub-contexts in order to specify related property values in a readable, grouped manner (for example positions or sizes)

Have a look at the following example to get an impression of the capabilities this class offers:

background { /* it == BackgroundContext.() -> Unit */
image { "https://via.placeholder.com/150/?text=Klein" }
repeat { repeatX }
positions { /* sub context */
horizontal { center }
vertical { center }
}
}

Parameters

styleParams

basic context scope interface

target

the defined output StringBuilder to write the generated CSS into

Constructors

Link copied to clipboard
fun BackgroundContext(styleParams: StyleParams, target: StringBuilder)

Functions

Link copied to clipboard
fun attachment(value: BackgroundAttachments.() -> BackgroundAttachmentProperty)

This function is used to set the background-attachment property. Predefined values are offered by BackgroundAttachments.

Link copied to clipboard
fun blendMode(value: BackgroundBlendModes.() -> BackgroundBlendModeProperty)

This function is used to set the background-blend-mode property. Predefined values are offered by BackgroundBlendModes.

Link copied to clipboard
fun clip(value: BackgroundBoxValues.() -> BackgroundBoxProperty)

This function is used to set the background-clip property. Predefined values are offered by BackgroundBoxValues.

Link copied to clipboard
fun color(value: Colors.() -> Property)

This function is used to set a color for the background-color property.

Link copied to clipboard
fun image(value: () -> Property)

This function is used to set a URL for the background-image property.

Link copied to clipboard
fun noImage()

This function is used to set the value for the background-image property to `none`.

Link copied to clipboard
fun origin(value: BackgroundBoxValues.() -> BackgroundBoxProperty)

This function is used to set the background-origin property. Predefined values are offered by BackgroundBoxValues.

Link copied to clipboard
fun position(value: BackgroundPositions.() -> BackgroundPositionProperty)

This function is used to set the background-position property. Predefined values are offered by BackgroundPositions.

Link copied to clipboard
fun positions(value: BackgroundPositionContext.() -> Unit)

This function opens a sub scope in order to set the two dimensions (horizontal and vertical) of the background position independently.

Link copied to clipboard
fun repeat(value: BackgroundRepeats.() -> BackgroundRepeatProperty)

This function is used to set the background-repeat property. Predefined values are offered by BackgroundRepeats.

Link copied to clipboard
fun size(value: BackgroundSizes.() -> BackgroundSizeProperty)

This function is used to set the background-size property. Predefined values are offered by BackgroundSizes.

Link copied to clipboard
fun sizes(value: BackgroundSizeContext.() -> Unit)

This function opens a sub scope in order to set the two dimensions (horizontal and vertical) of the background size independently.

Properties

Link copied to clipboard
open override val lgProperties: StringBuilder

collects the properties for large screens

Link copied to clipboard
open override val mdProperties: StringBuilder

collects the properties for middle-sized screens

Link copied to clipboard
open override val smProperties: StringBuilder

collects the properties for small screens

Link copied to clipboard
open override val xlProperties: StringBuilder

collects the properties for extra-large screens