home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Skins
How Do I Get The Colours That I Want?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="mm1352000" data-source="post: 1205363" data-attributes="member: 82144"><p>The wiki may well be wrong. Its happened in the past and I'm sure it will happen again in the future.</p><p></p><p></p><p>As you can see from the code, the engine doesn't appear to explicitly handle decimals for the colordiffuse, colorkey and textcolor elements/attributes. I can't say more than that.</p><p></p><p></p><p>Again, as you can see from the code, it appears that your imagination was wrong.</p><p></p><p></p><p>From what I can see, the #cc00ff00 can only ever be recognised as a valid colour in one scenario due to a quirk of the engine's colour caching mechanism.</p><p></p><p>Use of cc00ff00 (always valid) will cause the engine to cache the corresponding colour (ARGB cc00ff00) with cache key #cc00ff00:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L311" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L311</a></p><p></p><p>If you <strong>subsequently </strong>attempt to use colour #cc00ff00, the engine code will start with the assumption that you're attempting to use a named colour. That assumption is based on the presence of the non 0-9A-Fa-f character (#) in the colour value:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L267-L278" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L267-L278</a></p><p></p><p>So, isNamedColor will be true even though we know that #cc00ff00 is not and never has been a valid named colour.</p><p></p><p>We can ignore the next little section of code because #cc00ff00 does not contain a colon:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L284-L304" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L284-L304</a></p><p></p><p>Now we come to the revelation. Before attempting to convert the assumed-to-be-valid-named-colour to it's ARGB representation, the engine checks the cache for the corresponding key. The key for a named colour is just its name, which in this case is #cc00ff00:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L305" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L305</a></p><p></p><p>If you recall, the cc00ff00 colour was previously also stored with that same #cc00ff00 cache key.</p><p></p><p>...and now you should understand what's going on. <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink ;)" loading="lazy" data-shortname=";)" /></p><p></p><p>Had you not previously used that cc00ff00 colour, the engine would try to convert #cc00ff00 to it's ARGB representation using Color.FromName(). That function silently fails and returns a colour with ARGB value 0 (black). As a result, the engine will cache #cc00ff00 as ARGB 0. Subsequent attempts to use either cc00ff00 or #cc00ff00 would result in use of ARGB 0 instead of the desired ARGB cc00ff00.</p><p></p><p></p><p>So I repeat: catavolt's advice to not use the # prefix is good.</p><p></p><p></p><p>You have the code so you can see how it works. I advise you to use it and not get hung up on what the wiki says. Please do update the wiki if/where it is not correct. This would be much appreciated.</p><p></p><p></p><p>DISCLAIMER:</p><p>I'm not a skin engine expert, and I didn't write the code or the wiki content that has been linked here. I'm simply trying to assist you towards an answer to your question(s).</p></blockquote><p></p>
[QUOTE="mm1352000, post: 1205363, member: 82144"] The wiki may well be wrong. Its happened in the past and I'm sure it will happen again in the future. As you can see from the code, the engine doesn't appear to explicitly handle decimals for the colordiffuse, colorkey and textcolor elements/attributes. I can't say more than that. Again, as you can see from the code, it appears that your imagination was wrong. From what I can see, the #cc00ff00 can only ever be recognised as a valid colour in one scenario due to a quirk of the engine's colour caching mechanism. Use of cc00ff00 (always valid) will cause the engine to cache the corresponding colour (ARGB cc00ff00) with cache key #cc00ff00: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L311[/URL] If you [B]subsequently [/B]attempt to use colour #cc00ff00, the engine code will start with the assumption that you're attempting to use a named colour. That assumption is based on the presence of the non 0-9A-Fa-f character (#) in the colour value: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L267-L278[/URL] So, isNamedColor will be true even though we know that #cc00ff00 is not and never has been a valid named colour. We can ignore the next little section of code because #cc00ff00 does not contain a colon: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L284-L304[/URL] Now we come to the revelation. Before attempting to convert the assumed-to-be-valid-named-colour to it's ARGB representation, the engine checks the cache for the corresponding key. The key for a named colour is just its name, which in this case is #cc00ff00: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControlFactory.cs#L305[/URL] If you recall, the cc00ff00 colour was previously also stored with that same #cc00ff00 cache key. ...and now you should understand what's going on. ;) Had you not previously used that cc00ff00 colour, the engine would try to convert #cc00ff00 to it's ARGB representation using Color.FromName(). That function silently fails and returns a colour with ARGB value 0 (black). As a result, the engine will cache #cc00ff00 as ARGB 0. Subsequent attempts to use either cc00ff00 or #cc00ff00 would result in use of ARGB 0 instead of the desired ARGB cc00ff00. So I repeat: catavolt's advice to not use the # prefix is good. You have the code so you can see how it works. I advise you to use it and not get hung up on what the wiki says. Please do update the wiki if/where it is not correct. This would be much appreciated. DISCLAIMER: I'm not a skin engine expert, and I didn't write the code or the wiki content that has been linked here. I'm simply trying to assist you towards an answer to your question(s). [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Skins
How Do I Get The Colours That I Want?
Contact us
RSS
Top
Bottom