您提到了类jfx-decorator
和jfx-decorator-buttons-container
,但您的示例 CSS 使用了类jfx-decorator-buttons
和container
。我不确定您真正想要哪些类,但我会添加后者,因为这会从您的示例中生成 CSS。
class Styles : Stylesheet() {
companion object {
val jfxDecoratorButtons by cssclass()
val container by cssclass()
}
init {
jfxDecoratorButtons and container {
backgroundColor += Color.RED
}
}
}
更新:您更改了问题中的代码,因此这里是生成该输出的更新版本:
class Styles : Stylesheet() {
companion object {
val jfxDecoratorButtonsContainer by cssclass()
}
init {
jfxDecoratorButtonsContainer {
backgroundColor += Color.RED
}
}
}
驼峰式选择器会自动转换为带有连字符的小写。您还可以在cssclass
委托函数中指定确切的名称:
val myCssClass by cssclass("my-slightly-different-css-class")
另请注意,由于该backgroundColor
属性接受多个值,因此您必须使用 将颜色“添加”到颜色列表中+=
。这是所有接受多个值的属性的通用模式。