Kodi Community Forum

Full Version: button and $VAR[]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
seems like we are unable to use variables in buttons. is this a bug?

if i define this:

PHP Code:
<variable name="AccentColor">
        <
value condition="SubString(Skin.CurrentColourTheme,Brown)">brown.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Blue)">blue.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Green)">green.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Lime)">lime.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Magenta)">magenta.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Orange)">orange.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Pink)">pink.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Purple)">purple.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Red)">red.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Viridian)">viridian.png</value>
        <
value>black.png</value>
    </
variable>
    
    <
variable name="AccentColor_Light">
        <
value condition="SubString(Skin.CurrentColourTheme,Brown)">brown_light.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Blue)">blue_light.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Green)">green_light.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Lime)">lime_light.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Magenta)">magenta_light.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Orange)">orange_light.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Pink)">pink_light.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Purple)">purple_light.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Red)">red_light.png</value>
        <
value condition="SubString(Skin.CurrentColourTheme,Viridian)">viridian_light.png</value>
        <
value>black_light.png</value>
    </
variable

and call it here:

PHP Code:
<control type="button" id="1000">
                <
description>Buttons</description>
                <
width>350</width>
                <
height>48</height>
                
                <
align>left</align>
                <
aligny>center</aligny>
                <
font>SortMenu</font>
                <
label>-</label>
                <
textoffsetx>5</textoffsetx>
                <
texturefocus>$VAR[AccentColor_Light]</texturefocus>
                <
texturenofocus>$VAR[AccentColor]</texturenofocus>
                <
pulseonselect>false</pulseonselect>
                <
textcolor>AccentNegative</textcolor>
                <
focusedcolor>AccentNegative</focusedcolor>
                <
disabledcolor>Unfocused</disabledcolor>
                
            </
control

it doesn't use the images defined in the variables, but if i use them directly it works. it also works using the variables in the texture tag of image controles.
Wouldn't it be easier to just use separate colour themes?

Have you tried <texturefocus>$INFO[SubString(Skin.CurrentColourTheme)].png</texturefocus> ?
that won't work either

we only support infolabels in image control in <texture> and multiimage in <imagepath>
Themes it is then.

EDIT: If your button textures are white then you could use variables for the colordiffuse.
(2012-09-04, 17:26)Hitcher Wrote: [ -> ]Wouldn't it be easier to just use separate colour themes?
Actually thats what i'm doing. as for my understanding there are themes (for style e.g.: rounded corners vs sharp ones or dark layout vs light) and colour themes (e.g.: for text colour). if i would use themes to achieve this i would have to do red dark, red light, green dark, green light, ... and in addition the user would have to change the colour theme also because of the text and diffuse colours. so i thought it would be better to create a dark and light theme and in addition colour themes by "colour".xml
works most of the time using variables and white textures diffused by the accent colour, but buttons are a bit tricky


Quote:Have you tried <texturefocus>$INFO[SubString(Skin.CurrentColourTheme)].png</texturefocus> ?

doesn't work



(2012-09-04, 18:16)Hitcher Wrote: [ -> ]Themes is then.

EDIT: If your button textures are white then you could use variables for the colordiffuse.

was my first thought, too, because that's what i'm doing all the time with images, but buttons seem to be a different story, because that:

PHP Code:
<default type="button">
        <
posx>0</posx>
        <
posy>0</posy>
        <
width>300</width>
        <
height>48</height>
        <
align>left</align>
        <
aligny>center</aligny>
        <
font>SortMenu</font>
        <
label>-</label>
        <
textoffsetx>5</textoffsetx>
        
        <
texturefocus colordiffuse="AccentNegative">white.png</texturefocus>
        <
texturenofocus colordiffuse="Accent">white.png</texturenofocus>
        <
pulseonselect>false</pulseonselect>
        <
textcolor>AccentNegative</textcolor>
        <
focusedcolor>AccentNegative</focusedcolor>
        <
disabledcolor>Unfocused</disabledcolor>
    </default> 

ignores the colordiffuse and only shows the white texture without diffuse...
colordiffuse is separate.

PHP Code:
<colordiffuse>$VAR[AccentColor]</colordiffuse
and for which texture will this diffuse be applied?

EDIT:
applied for both, but thats not ideal i think. in my case it's ok because the color behind the button is the same as the <texturenofocus> so i leave it blank, but if this wasn't the case i guess it couldn't be done (at least in DialogContextMenu.xml because we have no access to the content like in DialogButtonMenu.xml).

perhaps it is something that could be changed in the button code? e.g. allow infolabels in button textures?

or has anybody ever thought about filling textures with colors instead of files. internally the core could diffuse a white stretched pixel with the color given in <texture>. perhaps this could save some byte, because plaine colored files don't have to be saved in the textures.xbt
will discuss with jmarshall allowing infolabels for all textures and adding colordiffuse attribute for each texture
Code:
<texture colordiffuse="AARRGGBB">texture.png</texture>

but this will have to wait until he will get back from well deserved holidays Wink
sounds good to me.
hopefully he doesn't get the holidays he deserves, otherways we'll have to wait a looooong time...Rofl
(2012-09-04, 23:27)pieh Wrote: [ -> ]will discuss with jmarshall allowing infolabels for all textures and adding colordiffuse attribute for each texture

any news on that?
nope, he's not yet back ... and soon I will be away for few days
(2012-09-04, 23:27)pieh Wrote: [ -> ]will discuss with jmarshall allowing infolabels for all textures and adding colordiffuse attribute for each texture
Code:
<texture colordiffuse="AARRGGBB">texture.png</texture>

but this will have to wait until he will get back from well deserved holidays Wink

I guess you guys are both back in business Big Grin

any news on that?

Hi Pieh

Any news on the subject? Could really use the "colordiffuse" tag on individual textures :-)

thanks in advance

Cheers
C_bb
Pages: 1 2