<@UBM6HQ2DN> I'm curious about the project require...
# tornadofx
c
@fucata I'm curious about the project requirement to use declarative statements over CSS. I think you'll find yourself fighting JavaFX at every turn if you go with this approach. That is, with a component like ComboBox, there are multiple styles involved: hover, select, etc. This example sets the style using a Kotlin assignment, but you'll see that the hover will also need to be accommodated.
f
@carlw it's because the combobox will be reused with different color and there'll be day and night mode in the app. Currently, we have a widget that take a color object as a parameter and pass it to things inside it. one of them is the combobox. I personally don't agree this color object idea but that's what the team decided
c
If you're building reusable widgets, styles are the way to go. You can then expose the style names to the widget user and they don't need to pass individual style settings like Colors to customize the objects, just pass in a class name as a key to a stylesheet.
ex, expose .customcombo-background, .customcombo-text-fill
f
@carlw I'm interested to move the coloring from constructor to stylesheet. how can have the stylesheet implement only to specific scope like the picture below?
Just for the sake trying. this is the typesafe css file called "LanguageSelectorStyle" that will apply the c(Colors["UI_PRIMARY"]. on the other hand, I have similar file called "LanguageSelectorStyle2" that will apply the c(Colors["UI_SECONDARY"]. how can I put them into smaller scope so primary color is not conflicting with secondary color?
Maybe I should refine this. The question is, components inside the widget have "elements" and "set id" to be selected in the stylesheet. How to scope the style so that element A can have blue, but on the other side, element A can have red