-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[MANUAL SQUASH] Formspec: Introduce default element styling/theming #16161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[MANUAL SQUASH] Formspec: Introduce default element styling/theming #16161
Conversation
There is one concern: how should compatibility be handled here? Unknown properties currently result in warnings. Shall the warnings simply be skipped in this case? |
It's probably a good idea for this to exactly match the style/style_type syntax - including tag names and [] - for consistency and to allow more than just style_type - what about bgcolor and backgrounds? |
There's a little problem with the current code (as of master): We have the following which can be used separately:
Now the motivation of this PR is to replace the default button appearance (
There is no convention for button naming, and those found in builtin are undocumented. Thus,
Would you please be so nice to elaborate this a bit more? I do not understand this question. Now with this PR I am using |
2b935ed
to
ac1b4b4
Compare
It's more about having a consistent format and not inventing a new one. You can just say it's a list of style_type[] tags, documentation here. Regarding style[]: there are some conventions -
The bgcolor formspect element allows you to set the background color of a formspec. background/background9 lets you set the background of a formspec to an image |
Fair. I adapted the code to have a separate list of formspec elements allowed for theming. Documented accordingly. In devtest, the provided example code results in the following beautiful theme: (ignore the font; it's the server-sent font media test I did not yet disable) |
This introduces a new setting to customize the default appearance of formspecs. Server-sent 'formspec prepends' will internally overwrite this setting.
Indeed, but I haven't yet seen any case where
Yes, that would be an option. Then we'd have the following layers:
|
And yet - it seems that Lines 3655 to 3656 in 535d757
@rubenwardy What was the original intend of the 9-sliced button rendering? |
I don't really understand what question you're asking bgimg_middle allows you to make scalable background images for button theming, see the wikipedia page: https://en.wikipedia.org/wiki/9-slice_scaling The padding is used to offset the content, it's helpful for getting a pressed effect I believe |
@rubenwardy Thanks for the explanation. I am confused because
If the
However, I would like to style the scrollbar and ticker buttons too. These do not always have a separate formspec element (e.g. textarea), thus At this point I do not know how to proceed, as the established code does not want to fit into the feature what I would like to implement. |
Yeah the bgimg is supported with both border=1 and border=0. With bgimg_middle, it's most useful to replace the border completely with border=0
I think padding defaulting to bgimg_miggle might be done as a default to get the text insets to just work with custom bgimg_middles
Okay - so the problem is that you want to replace the default border with a bgimg 9 slice, but don't want to break mods that use border=false to hide the border and just have the button text It feels like you're introducing a lot of complexity just because you don't like the new flat buttons. More generally, the user request for this is #10192 which would override button themes rather than changing the default. There needs to be more thought into how the styles should cascade as the styling system isn't designed for this
This is #9692 |
Exactly. That's currently the pain point. I will introduce skin overrides, which will allow mods (or games) to provide a uniform appearance across all elements. Thank you for linking to #9692. It's exactly what I'd also like to change - just not on a per-element basis.
By overriding the draw functions in EDIT:
Doesn't this predate the formspec styling feature? I believe that my PR will do exactly that. The priority should be as follows:
|
c0ea395
to
bd0d9a7
Compare
This PR is based on #16146 to ensure the best experience. This is optional.
Commit 1: (using commit f14b495 for demonstration)
Commit 2++:
To do
This PR is Ready for Review.
How to test
texture_pack.conf