diff --git a/app/src/main/kotlin/insulator/ui/common/InsulatorView.kt b/app/src/main/kotlin/insulator/ui/common/InsulatorView.kt index ec549748..dcc8ad08 100644 --- a/app/src/main/kotlin/insulator/ui/common/InsulatorView.kt +++ b/app/src/main/kotlin/insulator/ui/common/InsulatorView.kt @@ -1,8 +1,10 @@ package insulator.ui.common +import insulator.ui.style.Root import insulator.viewmodel.common.InsulatorViewModel import javafx.scene.control.Alert import tornadofx.View +import tornadofx.addClass import tornadofx.alert import tornadofx.onChange @@ -13,6 +15,7 @@ abstract class InsulatorView(title: String? = null) : View(title) { open fun onError(throwable: Throwable) {} override fun onDock() { + root.addClass(Root.insulatorView) val handleError: (Throwable?) -> Unit = { if (it != null) { alert(Alert.AlertType.WARNING, it.message ?: it.toString()) diff --git a/app/src/main/kotlin/insulator/ui/style/Root.kt b/app/src/main/kotlin/insulator/ui/style/Root.kt index 4143b4a0..2534a49f 100644 --- a/app/src/main/kotlin/insulator/ui/style/Root.kt +++ b/app/src/main/kotlin/insulator/ui/style/Root.kt @@ -6,28 +6,39 @@ import tornadofx.Dimension import tornadofx.Stylesheet import tornadofx.box import tornadofx.c +import tornadofx.cssclass import tornadofx.em import tornadofx.multi import tornadofx.px class Root : Stylesheet() { + companion object { + val insulatorView by cssclass("insulator-view") + } + init { root { font = Font.font("Helvetica", 10.0) backgroundColor = multi(theme.backgroundColor) + } + + insulatorView { padding = box(theme.viewPadding) - contextMenu { - padding = box(0.px) - minWidth = 100.0.px - textFill = theme.black - menuItem { - padding = box(10.0.px) - and(focused) { - backgroundColor = multi(theme.mainColor) - label { - textFill = theme.backgroundColor - textFill = theme.backgroundColor - } + } + + contextMenu { + padding = box(0.px) + minWidth = 100.0.px + backgroundColor = multi(theme.backgroundColor.brighter()) + menuItem { + padding = box(10.0.px) + label { + textFill = theme.black + } + and(focused) { + backgroundColor = multi(theme.mainColor) + label { + textFill = theme.backgroundColor } } }