[solved] How Do I Get The Colours That I Want? (1 Viewer)

CyberSimian

Test Group
  • Team MediaPortal
  • June 10, 2013
    1,994
    1,234
    Southampton
    United Kingdom United Kingdom
    Country flag
    Well, I have eliminated all use of the "#" in colours (mostly, but not entirely, in code that I had added or modified), and... it now all works as expected. :) :) :)

    Thanks, guys.

    -- from CyberSimian in the UK
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    11,828
    6,680
    Kyiv
    Ukraine Ukraine
    Country flag
    You don't know that no one uses the # symbol in the color designation. Any third party skin including unmaintained skins could be using that.
    Let use, they are in the case of source code changes will have the color of which was conceived by the author rather than the default color.

    Nothing will happen, because if the author thought of color #FFCCDDAA, he will receive it and, rather than an error in the log file and the default color.
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    11,828
    6,680
    Kyiv
    Ukraine Ukraine
    Country flag
    Here it is a small change will not affect the skins work, and will work just as described in the wiki.
    https://github.com/MediaPortal/Medi...al/Core/guilib/GUIControlFactory.cs#L265-L278
    C#:
                if (valueText.Length > 0)
                {
                  bool isNamedColor = false;
                  bool isSharp = false;
    
                  if (valueText[0] == '#' && valueText.Length > 1)
                  {
                    valueText = valueText.Substring(1);
                    isSharp = true;
                  }
    
                  foreach (char ch in valueText)
                  {
                    if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f')
                    {
                      continue;
                    }
    
                    isNamedColor = true;
                    break;
                  }
    
                  if (isNamedColor && isSharp) // Property
                  {
                    valueText = "#" + valueText;
                  }
    Then the color specified in the skins as #AARRGGBB, AARRGGBB operate the same.

    @CyberSimian @catavolt
    Make JIRA Ticket? Make Corrections? :whistle::coffee:

    12345678 -- a decimal number
    #12345678 -- a hexadecimal number
    In MP Wiki, Color can have a value:
    • Hex values in the format #RRGGBB
    • Hex values in the format #AARRGGBB
    • Named colors
    No decimal, only hexadecimal for non named color ... :)
     
    Last edited:

    mm1352000

    Development Group
  • Team MediaPortal
  • September 1, 2008
    21,571
    8,218
    New Zealand New Zealand
    Country flag
    Well, I have eliminated all use of the "#" in colours (mostly, but not entirely, in code that I had added or modified), and... it now all works as expected. :) :) :)
    Great.
    So do you intend to update the wiki as requested, or...?

    Here it is a small change...
    Sorry, I will not support this change because:
    1. It may change colouring for existing skins in unexpected ways. If the skin designer previously used #AARRGGBB, that does not guarantee that they wanted the AARRGGBB colour. If they had wanted the AARRGGBB colour, they should have noticed that #AARRGGBB gave them black instead of AARRGGBB and fixed it.
    2. In the existing colour handling, # in a named colour (eg. "White:#60") means "hexadecimal" and no # in a named colour (eg. "White:60") means decimal. Supporting a # prefix for any colour is confusing because it doesn't match the existing hexadecimal meaning.
    3. In the wider skin engine, a # prefix is a define. Adding a # prefix for colours could introduce unexpected bugs.
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    11,828
    6,680
    Kyiv
    Ukraine Ukraine
    Country flag
    If the skin designer previously used #AARRGGBB, that does not guarantee that they wanted the AARRGGBB colour
    Why not? If I want a green apple, green apple I take, and I do not take the yellow lemon. If a designer wanted #AARRGGBB, he watched the color table, and knew what he wanted. If he had turned a different color then it would open a topic about it, as did @CyberSimian.
    In the existing colour handling, # in a named colour (eg. "White:#60") means "hexadecimal" and no # in a named colour (eg. "White:60") means decimal.
    Nothing changes:
    • White:#60 = White with HEX alpha = #60
    • White:60 = White with Decimal alpha = 60
    • AARRGGBB = HTML Color = AARRGGBB
    • #AARRGGBB = HTML Color = AARRGGBB
    • RRGGBB = HTML Color = RRGGBB
    • #RRGGBB = HTML Color = RRGGBB
    Supporting a # prefix for any colour is confusing because it doesn't match the existing hexadecimal meaning.
    How not? Media portal only supports hexadecimal color, and only in the alpha channel for a named colors supports both formats.
    In the wider skin engine, a # prefix is a define. Adding a # prefix for colours could introduce unexpected bugs.
    The procedure is not processing this symbol, if the system is able to determine the standard color, or if the color is in the cache, then we get what we wanted, or we'll get the default color that is white. But if you make the changes, then we will get the color as described in the wiki. Note the color value is not provided by the property.This is evident from the source code.
     

    mm1352000

    Development Group
  • Team MediaPortal
  • September 1, 2008
    21,571
    8,218
    New Zealand New Zealand
    Country flag
    I already explained! o_O

    If I want a green apple, green apple I take, and I do not take the yellow lemon.
    If I give you a yellow lemon when you ask for a green apple, I will assume that the yellow lemon is okay if you don't complain. You should have complained if the green apple was really important.

    If a designer wanted #AARRGGBB, he watched the color table, and knew what he wanted.
    Yes, I agree... but if the skin engine gives the designer black instead of AARRGGBB and the designer does not complain, the designer must think that black is okay too. Now after X years the designer and people who use the designer's skin expect black. If you change the black to AARRGGBB, the designer and users will be angry with you. It's much easier to fix the wiki and say that #AARRGGBB is not a valid colour value. That way the skin engine will stay the same and nobody will be angry.

    Nothing changes...
    Of course something changes!
    Now #AARRGGBB gives black.
    After your change, #AARRGGBB will give AARRGGBB.

    How not? Media portal only supports hexadecimal color, and only in the alpha channel for a named colors supports both formats.
    You know that MP only supports HEX colours... but other people do not. CyberSimian already thought # means HEX and no # means DECIMAL. If you add support for #AARRGGBB, even more people will be confused.

    The procedure is not processing this symbol...
    But other earlier procedures do! # means skin engine defined value (eg. BasicHome.xml: <define>#selecteditem:</define> etc.):
    https://github.com/MediaPortal/Medi...al/Core/guilib/GUIControlFactory.cs#L556-L571

    Please, let's just leave the code alone! There's no need to add support for #AARRGGBB.
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    11,828
    6,680
    Kyiv
    Ukraine Ukraine
    Country flag
    but if the skin engine gives the designer black instead of AARRGGBB and the designer does not complain, the designer must think that black is okay too
    White, not Black - return Color.White.ToArgb(); :whistle::coffee:
    If I give you a yellow lemon when you ask for a green apple, I will assume that the yellow lemon is okay if you don't complain. You should have complained if the green apple was really important.
    Since no one complains, then all got a green apple. In addition to @CyberSimian , he is complaining. :)
    the designer and users will be angry with you. It's much easier to fix the wiki and say that #AARRGGBB is not a valid colour value. That way the skin engine will stay the same and nobody will be angry.
    Designer, replace the #AARRGGBB on White, it is not difficult. The more so because the designer does not always get the white, it is in the case of falling into the standard colors to get the color he wanted.
    Color.FromName("#AARRGGBB") - In some cases, it is working.
    Now #AARRGGBB gives black
    White or AARRGGBB ... :) Why is described above.
    If you add support for #AARRGGBB, even more people will be confused.
    If they read the documentation that is written in it all.
    But other earlier procedures do! # means skin engine defined value (eg. BasicHome.xml: <define>#selecteditem:</define> etc.):
    This is another property. It does not refer to the color.
    Please, let's just leave the code alone! There's no need to add support for #AARRGGBB.
    I also said when I made corrections to the FH, LMH, if I did not correct these plug-ins are not sure that they would work. The same is true about MP1-4715. MP1-4831 etc.
    PS: https://forum.team-mediaportal.com/...-front-of-programs.135619/page-2#post-1205397 :whistle::coffee:
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    11,828
    6,680
    Kyiv
    Ukraine Ukraine
    Country flag
    I think it is to solve the designers. I can make these changes. And we can check. What is and what is not broken. I can not do. Solution for @Designers.
     

    mm1352000

    Development Group
  • Team MediaPortal
  • September 1, 2008
    21,571
    8,218
    New Zealand New Zealand
    Country flag
    White, not Black
    Black, not white!

    Code:
    return colCache.TryGetOrAdd(valueText, col => Color.FromName(valueText)).ToArgb();
    Color.FromName("#[AARRGGBB]").ToArgb() == 0 == BLACK

    return Color.White.ToArgb(); :whistle::coffee:
    This code will never be reached in the case of #AARRGGBB. isNamedColor must be true because of the #. Try it and you will see.


    It seems that you don't actually understand the code properly. No wonder you don't understand the damage your change can do!

    I've spend enough time (hours!) understanding the code and explaining to you and CyberSimian. You have my advice. I'm not going to waste any more time. If you break things it will be your own fault. Don't say I didn't warn you!
     

    wizard123

    Retired Team Member
  • Premium Supporter
  • January 24, 2012
    2,543
    2,615
    United Kingdom United Kingdom
    Country flag
    You don't know that no one uses the # symbol in the color designation. Any third party skin including unmaintained skins could be using that.
    Indeed some do i have seen it many times before over the years.
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    M HEVC 10 bit washed out colours Codecs, External Players 3
    Similar threads

    Top Bottom