Search Unity

Feature Request Professional Pseudo State and @Pro Notation

Discussion in 'UI Toolkit' started by BinaryCats, Oct 2, 2019.

  1. BinaryCats

    BinaryCats

    Joined:
    Feb 8, 2016
    Posts:
    317
    Hi,

    I work across different editors, in work (Professional skin) and at home(Default Skin). Often when I create an editor I want it to work (look nice) both at home and in work. Which means I have to litter my code with
    IsProSkin and alter the styling of elements.

    I would like to suggest some quality of life changes, which will make not only my use case easier but asset store creators lives easier too!

    I think it would be really useful if we could define the Pro styling similar to how we can style by Pseudo states

    e.g.
    Code (CSharp):
    1. .myText
    2. {
    3.     font-size: 12px;
    4.     color: rgb(0,0,0);
    5. }
    6.  
    7. .myText : pro
    8. {
    9.     font-size: 12px;
    10.     color: rgb(255,255,255);
    11. }
    I understand the
    :
    operator might not be the most correct, but hopefully you get the idea.


    I also really like the new
    @2x
    notation for automatically loading high DPI resources! I would like to suggest further support to
    [USER=37090]@pro[/USER]
    , which would automatically load the @pro resource if the user is using the Professional editor skin.
    e.g.
    Code (CSharp):
    1. myImage@Pro.png
    2. myImage.png
    3. myImage@2x@Pro.png
    4. myImage@2x.png
    5.  
    I hope you like my suggestions, Thanks for reading :)
     
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    Thanks for your suggestions! We are aware this area of our styling solution needs some improvement. We are working on proper theming support for UIElements, which is essentially having a global StyleSheet that you work against. In the new world, you would be able to use USS variables for styles that should match the current theme. So you can just use a single USS file but instead of saying
    color:red;
    , your would put
    color:var(--main-background-color);
    or something along those lines.

    For the @2x images, right now, if you use the
    resource()
    function (instead of
    url()
    ) in USS you should get this functionality. But it's something we do want to expand to
    url()
    in the future.
     
    BinaryCats likes this.
  3. BinaryCats

    BinaryCats

    Joined:
    Feb 8, 2016
    Posts:
    317
    Great that sounds interesting, I'll be interested to see how it pans out.
    Do you mean just for the @2x images, or do you mean the @pro suffix is already supported and using
    resource()
    will just work?
     
  4. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    Just for @2x. We don't have anything like "@pro".
     
    BinaryCats likes this.