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

BackgroundContext
Link copied to clipboard
js
fun BackgroundContext(styleParams: StyleParams, target: StringBuilder)
basic context scope interface

Functions

attachment
Link copied to clipboard
js
fun attachment(value: BackgroundAttachments.() -> BackgroundAttachmentProperty)
This function is used to set the background-attachment property.
blendMode
Link copied to clipboard
js
fun blendMode(value: BackgroundBlendModes.() -> BackgroundBlendModeProperty)
This function is used to set the background-blend-mode property.
clip
Link copied to clipboard
js
fun clip(value: BackgroundBoxValues.() -> BackgroundBoxProperty)
This function is used to set the background-clip property.
color
Link copied to clipboard
js
fun color(value: Colors.() -> Property)
This function is used to set a color for the background-color property.
equals
Link copied to clipboard
js
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
js
open fun hashCode(): Int
image
Link copied to clipboard
js
fun image(value: () -> Property)
This function is used to set a URL for the background-image property.
noImage
Link copied to clipboard
js
fun noImage()
This function is used to set the value for the background-image property to `none`.
origin
Link copied to clipboard
js
fun origin(value: BackgroundBoxValues.() -> BackgroundBoxProperty)
This function is used to set the background-origin property.
position
Link copied to clipboard
js
fun position(value: BackgroundPositions.() -> BackgroundPositionProperty)
This function is used to set the background-position property.
positions
Link copied to clipboard
js
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.
repeat
Link copied to clipboard
js
fun repeat(value: BackgroundRepeats.() -> BackgroundRepeatProperty)
This function is used to set the background-repeat property.
size
Link copied to clipboard
js
fun size(value: BackgroundSizes.() -> BackgroundSizeProperty)
This function is used to set the background-size property.
sizes
Link copied to clipboard
js
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.
toString
Link copied to clipboard
js
open fun toString(): String

Properties

lgProperties
Link copied to clipboard
js
open override val lgProperties: StringBuilder
collects the properties for large screens
mdProperties
Link copied to clipboard
js
open override val mdProperties: StringBuilder
collects the properties for middle-sized screens
smProperties
Link copied to clipboard
js
open override val smProperties: StringBuilder
collects the properties for small screens
xlProperties
Link copied to clipboard
js
open override val xlProperties: StringBuilder
collects the properties for extra-large screens