Justoverclock maybe should i use: less.modifyVars({ '@myvariable': 'my serialization of admin input' }); ?
Ralkage Justoverclock give it a shot or check how core does it with the primary and secondary colors from the Appearance section of the Admin CP ๐ you can try an in-line style attribute as well if you wanted to keep it simple. You could also possibly re-use the hex validate function logic that core uses to ensure that the value being entered is an actual hex value ๐
Justoverclock Ralkage done, but I canโt understand how the input field is serialized to less. what i want is to use a field where users can set theyr hex code
Dem13n https://github.com/Dem13n/discussion-cards/blob/master/src/Extenders/RegisterLessVariables.php
Justoverclock Dem13n so this allow me to create an input field and change variables through admin panel? I need to study this well, if someone can help with some example would be great! Thanks btw
Dem13n Justoverclock yes in the example above, 2 variables are registered, desktop-card-width and tablet-card-width https://github.com/Dem13n/discussion-cards/blob/master/less/forum.less
Justoverclock Dem13n sorry if my question are stupid, actually I canโt see this class into your less file, This means that they are created by your extender?
Justoverclock Dem13n i've made this https://discuss.flarum.org/d/26978-flarum-guest-engagement/21 and i'm trying a method to change the background color from admin panel (like flarum actually do with primary color)
Justoverclock what if i put an attribute to mithril directly into the code? m("div.foo", {style: {color: "red"}}, "hello") in this way can i change the value from admin panel?
wonderbeel It should work but keep in mind that inline styles 99% of the times are a bad idea. It is cleaner to add a class instead and use that class to style the element, this way you can also easily support the dark mode for example.
Justoverclock wonderbeel just trying to make this simple for me ๐ , i do not love to use inline style too