NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 19 20 21 22 23 … 93 Next »
Changing skin font or colour

 
  • 0 Vote(s) - 0 Average
Changing skin font or colour
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,945
Threads: 770
Joined: Nov 2003
#21
2010-07-16, 08:25 PM
imilne Wrote:Can I ask kindof the reverse: how do I read a colour from the xml into a plugin (so I can draw something in a colour defined by the skin)?

I've found SkinHelper.GetColor() but I'll be buggered if I can get it to work. Maybe I'm not specifying the colour properly in the skin? I've tried <NamedColor> and <Color> both within <NamedColors> and <Colors> groups. The SkinHelper always returns white, even if I pass it a string that doesn't exist.

Iain
GetColor() was really just meant as an internal method to the SkinHelper but for some reason it ended up public. Its sole purpose is to take string with a solid color name ("Black", "White", "Red", "LightGray" ... "Salmon" etc), or a web style color "#RRGGBB", and return the matching .Net Color object. It is not used for looking up custom color definitions in the skin file.
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#22
2010-07-16, 08:29 PM
Ah right. Does that mean we can't read colours from the skin (via your API)? I'll suss out another way if not...

Iain
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,945
Threads: 770
Joined: Nov 2003
#23
2010-07-16, 08:34 PM
No, not currently.

I can add a GetNamedColorText() method to the next build for you if you like. It'll return a string though, not a color, since the <Color> tag can be used to define complicated things like gradients etc which cant be held in a Color.

If you know your colors will be Solid, not gradients, then you could do something like skinHelper.GetColor(GetNamedColorText("@hightlingColor"));. If you wanted to cope with gradients you'd pretty much need to parse the text yourself and create the brush, since the gradients depend on the rectangle size etc.
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#24
2010-07-16, 08:43 PM
Yeah, this was to read two solid colours that would then be used to create a LinearGradientBrush in the code. I'll just parse the XmlDocument from GetBackingDocument() - I should be able to find what I'm after that way, and it only needs to be done once.

Although if you still want to add the method, it'll certainly help in my case Smile

Iain
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#25
2010-07-16, 09:03 PM
This is a bit clunky (and error prone for now), but from this xml:

Code:
<Colors>
    <Color name="customcolor" color="#ff0000"/>
</Colors>

You can get the colour via:

Code:
XmlDocument doc = skinHelper.GetBackingDocument();
XmlNodeList colors = doc.GetElementsByTagName("Color");
Color c = ColorTranslator.FromHtml(colors[0].Attributes[1].Value);

Obviously the array will need checked to ensure you've found the colour you're after, but it seems to work fine.
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,945
Threads: 770
Joined: Nov 2003
#26
2010-07-16, 09:06 PM
Find the correct color node with an xpath query like this:

string colorText = skinHelper.GetBackingDocument.SelectSingleNode("/Skin/Colors/Color[@name=\"customcolor\"]").InnerText;
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,445
Threads: 963
Joined: May 2006
#27
2010-07-16, 11:24 PM
sub Wrote:I just checked, and found I'd already implemented part of what you wanted. You can do something like this:

<Text text="@subtitle" location="0,13" size="90,10" font="@fontName" align="center"/>

And pass in the "@fontName" in the args:

To confirm this is just what I needed, thanks.

Martin
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,945
Threads: 770
Joined: Nov 2003
#28
2010-07-16, 11:47 PM
Great.
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#29
2010-07-17, 07:50 AM
sub Wrote:Find the correct color node with an xpath query like this:

string colorText = skinHelper.GetBackingDocument.SelectSingleNode("/Skin/Colors/Color[@name=\"customcolor\"]").InnerText;

Heh, even simpler. Excellent :-)

Iain
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#30
2010-07-23, 08:25 AM
Could someone explain to me how the "visible" attributes work?

I've seen a few references to it around, but I can't work out how to use it. Should I be able to control the visibility of elements, text, images, etc by defining a visible="@someValue" and then setting that to true/false in code?

I already control visible text by setting stuff I don't want shown to "". And for UiStatic elements I just don't add them to the render list. This works, but maybe I'm not doing it the best way...

Iain
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (4): « Previous 1 2 3 4 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Skin help (correct location?) SFX Group 4 4,145 2018-01-24, 07:42 AM
Last Post: pBS
  skin question pBS 2 3,521 2016-06-18, 07:03 PM
Last Post: pBS
  Skin - view further into the future, scale the guide Vitenka 5 3,590 2014-11-26, 07:28 PM
Last Post: Vitenka
  Changing the recording priority on recurring recordings cbgifford 4 4,123 2014-08-17, 03:13 PM
Last Post: Kiwi
  Skin element Details in NowNext Jaggy 2 1,981 2011-09-19, 11:50 PM
Last Post: Jaggy
  Changing recording schedules on the fly. mvallevand 2 2,108 2011-09-06, 03:30 AM
Last Post: BrettB
  Skin Help with Line Drawing Northpole 2 2,114 2011-07-19, 05:14 PM
Last Post: Northpole
  Anyone interested in developing a Skin Plugin? Hairy 13 5,519 2011-07-10, 04:13 PM
Last Post: mvallevand
  Skin help needed for EventDetails.xml bgowland 7 3,723 2011-06-26, 11:55 PM
Last Post: Jaggy
  A list of changing images McBainUK 1 2,024 2011-06-21, 04:36 PM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode