Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

inheriting the editor theme via custom .tss file

Discussion in 'UI Toolkit' started by jnhackleman_unity, Nov 25, 2021.

  1. jnhackleman_unity

    jnhackleman_unity

    Joined:
    Sep 16, 2021
    Posts:
    20
    Hi,
    I'm trying to inherit the editor theme via my custom .tss file.
    I know for runtime you do the following:

    Code (CSharp):
    1.  
    2. @import url("/Assets/UI Toolkit/UnityThemes/UnityDefaultRuntimeTheme.tss");
    3.  
    4. @import url("/Assets/Code/Common/reset.uss");
    5.  
    But what's the appropriate path for the current editor theme?
    Code (CSharp):
    1.  
    2. @import url("unity-theme://what-goes-here");
    3. @import url("IOEditorBase.uss");
    4.  
    Thanks
     
  2. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    529
    I personally lack experience importing theme in USS, but you may look into the ThemeRegistry class. It contains a dictionary that could help you find the path as it has changed over time.

    Can you test
    url("unity-theme://default");
    ?
     
  3. jnhackleman_unity

    jnhackleman_unity

    Joined:
    Sep 16, 2021
    Posts:
    20
    No joy. It ends up looking like the left window, when it should look like the right:
    https://gyazo.com/8b0589e0d7c5287da056dd2bed5e4f81

    "unity-theme://default" is default runtime. What I need is the active editor theme like I would get from this:
    https://gyazo.com/a927d7047083835dc97385ece874e6d3

    but then I'm also importing my custom overrides
     
  4. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    529
    After discussions with other devs, there is no way to import the editor theme because of multiples reasons, but everything you could do with a tss (and more) is possible with a regular stylesheet.
     
  5. jnhackleman_unity

    jnhackleman_unity

    Joined:
    Sep 16, 2021
    Posts:
    20
    alright - It's definitely a feature I think is warranted. As a tool developer: I don't want anyone to have to manaully add my necessary styles for my VisualElements on to any windows or views they create. This would lead to them likely modifying styles for my framework that should not be modified.