Font colors via $VAR[]'s
#1
I'm never sure where the best place to post such things are, as they border on feature requests, bug reports and just plain asking for advice on better ways to accomplish what I want. So, if this would be better elsewhere, please do move it Smile

I'm a great fan of user customisation, and have been playing about with user customisation of text colors using a variable - something like

Code:
    <variable name="selectedColor">
        <value condition="!IsEmpty(Skin.String(selectedColor))">FF$INFO[Skin.String(selectedColor)]</value>
        <value>FFFFFFFF</value>
    </variable>

With all references to the selected color then being (for example)

Code:
    <textcolor>$VAR[selectedColor]</textcolor>

and the color being chosen via a custom window in the skin. Generally this works great, except in two instances (that I've noticed in the ≈12 hours since I implemented this) - label2's on Buttons which display such a label don't use the color (for example, the currently selected skin on the Select Skin button in Settings > Appearance), and the label on Edit controls.

In these cases, the label doesn't appear, suggesting it isn't getting any color value at all. All other instances (that I've tested so far) correctly use the color specified by the variable.

To be clear, I'm developing against the latest Helix nightlies, but have confirmed the same behaviour in the latest Gotham release. Is this a known issue? If so, is there any chance of a fix in Helix? If either of the previous are true, is there any more information I can provide? And if neither are true, can anyone suggest any alternative methods for allowing the user to set the color of text that would apply to label2's and edit controls?

Thanks Smile
Reply
#2
For the ones that don't seem to take a VAR you could probably set a fallback for now.

<textcolor fallback="color">

Not a fix but at least they would not be empty.
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#3
you could use
Code:
<label>[COLOR $VAR[FontColorVar]] SomeText [/COLOR]</label>
for all your labels you want to color and let label2, edits etc fallback to <textcolor>
still a workaround though.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#4
(2014-08-31, 02:11)MassIV Wrote: For the ones that don't seem to take a VAR you could probably set a fallback for now.

<textcolor fallback="color">

Not a fix but at least they would not be empty.

That simplifies my variables (no more <value/> node) - and thank you for that - but as soon as the user sets a color (so the variable is actually returning something), the label2's and edit control still appear invisible. It's an improvement, though Smile (it works until the user starts to customise - that's a infinite improvement over the current state Wink)

(2014-08-31, 02:13)phil65 Wrote: you could use
Code:
<label>[COLOR $VAR[FontColorVar]] SomeText [/COLOR]</label>
for all your labels you want to color and let label2, edits etc fallback to <textcolor>
still a workaround though.

TBH, that feels like I'm working around something that already works (the primary labels) rather than the issue. If it was just about providing a fallback for that label2's etc I'd be providing all the colors via themes but, with over 200 possible background and overlay colors (I really should have checked this actually worked before writing the color selection dialog Wink), I can't program that many themes and using fallbacks for the label2's etc limits it even more. Thanks for the suggestion, though Smile
Reply
#5
no, it works around havin disappearing label2´s etc when coloring the primary font with <textcolor>. that way you can choose both colors independently. (does not work for for buttons generated by xbmc itself though, those with default ids because you cant edit the <label> tag there)

...and you can also use
Code:
<label2>[COLOR $VAR[FontColorVar]] SomeText [/COLOR]</label2>
of course
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#6
(2014-08-31, 02:28)phil65 Wrote: no, it works around havin disappearing label2´s etc when coloring the primary font with <textcolor>. that way you can choose both colors independently. (does not work for for buttons generated by xbmc itself though, those with default ids because you cant edit the <label> tag there)

You're right of course Blush (at my age it takes time to actually think through these things, let alone test them!) With your suggestion, the user choice is used for the primary label, the label2 (or the edit control) goes to the color selected in the color theme (not the fallback, which isn't specified with this method - which is where I'm going to claim my confusion came from Wink). A quick test suggests this works quite nicely as a workaround until such time as (hopefully) a fix comes into Kodi. Thank you Smile
Reply
#7
phil65's solution works great - except for one huge issue Big Grin By specifying the color within the <label/> tag, the ability to vary the label color depending on focus (or disabled, or even invalid) is lost, which severely limits the usability of the controls.. So close - very VERY close - yet so far Smile
Reply
#8
You can vary the color with the control.hasfocus(id) condition in your variable.
[Image: xp1080-21.png]
Reply
#9
Ingenious Smile Feels like I'm getting close to sorting this (with everyones wonderful help). That's got it working everywhere where I define the instances of the controls. Any idea how it could be extended to SettingsCategory.xml for example, where I just provide a default button, and so can't add [COLOR] tags into the label? Thanks again.
Reply
#10
(2014-08-31, 22:59)`Black Wrote: You can vary the color with the control.hasfocus(id) condition in your variable.

Would be even simpler if we could use Control.HasFocus() without the id and XBMC used the current control's ID as fallback. Wink
Reply
#11
I just discovered this thread after running into this same issue too.

I have been playing around to make all colors in my skin user configurable by setting a Skin String as color on all controls.
This works very well for every part of the skin, except:

- label2 of a button control
- label2 of a slider control
- text of a textbox control while inside a container

Any chance this will be fixed some day ?
Reply
#12
Also doesn't work for edit controls.
Reply
#13
(2015-05-19, 17:35)braz Wrote: Also doesn't work for edit controls.

Confirmed, doesn't work either...

For now I'll just use the static color for the elements that don't like the dynamic color set by a VAR or Skin setting.

Is this to be considered a bug in kodi or is it by design and shouldn't we be using the VAR's on color parameter at all ?
Reply
#14
I use VARs for heaps of colour stuff, so I hope its not by design...
Reply
#15
Maybe using the new include type (Isengard) ?

Code:
<include name="MyTextColor">
    <param name="textcolor" default="FFFFFFFF"/> <!--default acts like fallback-->
    <definition>
         <textcolor>$PARAM[textcolor]</textcolor>
    <definition>
</include>

and call it :

Code:
<include name="MyTextColor">
    <param name="textcolor" value="FF$INFO[Skin.String(selectedColor)]"/>
</include>

Didn't tried it so far but this should avoid the $VAR use.
[Skin] KOver - V1.1.0 Stable (Repo version)
[WIP] ReKOver - Skinning tool project

If I've been helpful or you like my work, hit "THANK USER" button ;) ...
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
Font colors via $VAR[]'s00