I am creating some custom themes and understand what most styles are but I cannot understand what the ‘sb’ is relating to!
style.list.sb
style.ta.sb
etc
Other things i can work out: bg = background, scrl = scroll bar, btn = button. But not sure what sb means and changing this, specifically in the text area, does not seem to do anything!
In the interest of ‘Clean Code’ it might be worth giving things full, non-abbreviated, names in a future release. Although I can appreciate this causing backward compatibility issues.
I’m still confused. ta (text area) has the following styles:
lv_style_t * area;
lv_style_t * oneline;
lv_style_t * cursor;
lv_style_t * sb;
Area appears to be the main property to allow you to change the text box colour, border etc.
I guess cursor, if not NULL allows you to set the cursor colour.
What is oneline and sb??
Scrollbar, that makes sense, and explains why changing this property isn’t doing anything for me as i’m using a single line.
So does that mean that Oneline and Cursor(?) should really be removed from the Theme struct if its not used? Although I’m guessing that Cursor is used depending on the cursor mode selected!
Sorry what I meant was I would rather just use SCROLLBAR instead of the slightly shorter version.
scr should be screen (i believe thats what it means!)
bg becomes background
cont becomes container
rel becomes release
etc, etc, just say what it is
I would even make tgl_rel toggle_release etc
I have also noticed, going though lv_theme_t, that there are some larger, better named items such as day_names, highlighted_days etc. These are perfect and very clear.
And while we are on the subject (or maybe this should be for a feature topic) the label structure appears, as far as I can tell, to be optional. So i would be tempted to remove this altogether.
Please don’t take this as moaning, I’m not, just constructive feedback
One “pro” for shorter naming conventions is that it saves typing during modification. To me there’s a tradeoff between having it short and easy to type, or making it long and expecting the user to have autocompletion or type it by hand.
In my opinion, having a clear mapping in the documentation between abbreviations and their meaning is acceptable. Once you know that rel means release you probably aren’t going to forget it too easily.
I was thinking a lot about REL, scr, btn and similar abbreviations. IMO long names like lv_button_set_state(my_button, LV_BUTTON_STATE_RELEASED)
are hard to read because the gist loses in the long expressions.
Just to compare: lv_btn_set_state(my_btn1, LV_BTN_STATE_REL)
So my principle was to find a balance between easy recognition and length. However, I really failed with sb because it’s hard to recognize.
I know what you are saying, and we might just have to agree to disagree on this … However:
Is this really that hard to read or remember?
Also the trouble with abbreviations is people might think they should be abbreviated differently, I could argue you have already done that. You have made Release Rel, yet you have made Button Btn, why not But? or make Release Rls?
Whereas using the full name there is no ambiguity, button is button
This would then make it easy to come up with a better name for sb, as it would be ‘scrollbar’
Again, I would argue that if you someone doesn’t understand an abbreviation they could just look it up in the documentation (which they should have already read anyways ).
Refactoring the whole lib is definitely out of scope now, but I agree to update the most ambiguous abbreviations.
Usually, I use the full names in the comments, so it should be one click to see what a defines/enum really means.
My rule was to keep names <= 8 char long (also arbitrary). With this in mind: ta -> textarea cb -> checkbox sb -> scrlbar(7) or scrollbar (9) (scrl is used in lot of places)