<@U10EJRH2L> I have another Css question, I see th...
# tornadofx
n
@Ruckus I have another Css question, I see that you defined
baseColor
in
PropertyHolder
I would like to use some other properties defined in the default Stylesheet from JavaFx like
-fx-inner-border
but I can't use
cssprop
. So how would I define some properties in my own Type-Safe-Css class referencing the default stylesheet (Modena)? Or do we just have to add all of the root variables from the stylesheet in
PropertyHolder
if so I would be happy to sent a PR.
r
There's a
cssproperty
function specifically for this. It requires a type and you can override the name. For example, the
NewViewTransitionStyles
(in the test apps) defines a
nuke
custom property for theming:
Copy code
val nuke by cssproperty<Paint>()
...
box and red {
    nuke.value = nukeRed
}
Sadly we have to use the
nuke.value
format since we can't override
=
.
n
Hey @Ruckus, thanks for the replay.. hehe I actually new about the
cssproperty
. I guess I did ask the wrong question. I am just wondering if there is a reason why not all the root properties defined in (Modena) are defined in
PropertyHolder
class. If create a custom controls I often want to use the default color properties (like
-fx-base-color
...) so that I can just change the base colors and all the controls change accordingly?
r
We actually had a debate with that, and I don't remember the exact reason we decided not to add them, but we did decide it would be better to instead have a base Stylesheet class that would have all the JavaFX properties in it, and it could be extended for other derived user-agents that could add their own properties as well (i.e. ModenaStylesheet, CaspianStylesheet, MaterialStylesheet, etc.). We couldn't make the change right away though, so we added the most commonly used top level properties for now, and figured the
cssproperty
workaround would be good enough for the others for now.
My guess is, the new implementation will be part of the v2 stuff.
n
Mhm yah I just don't like the
prop.value
thing 😀.... but v2 sounds like a plan.... I am actually playing with a MaterialStylesheet/Theme which allows to use the default controls, but it will take a while till it will be any where close to be usable 🙈
r
We've wanted to do that for a while now, but even using new skins for the controls so they could have the nice Material interactions and stuff without having to create all new controls.
n
That's what I am actually doing, I am writing new skins define them in a typesafe css file. And if the controls get extra functionally this is done through extension function/properties. The user just adds the maven dependency and the material theme will be loaded automatically and if the default color palette is not the one wanted the developer can choose a different color palette. I will show some examples soon...
r
Awesome! I can't wait to see
n
😀 Will probably need help down the line from an css expert 😎
r
That's definitely not me, but I'll try to help where I can
😁 1