Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a XAML Theming spec #5772

Closed
wants to merge 12 commits into from
Closed

Conversation

zadjii-msft
Copy link
Member

@zadjii-msft zadjii-msft commented May 6, 2020

Summary of the Pull Request

This PR aims to outline my vision for what "XAML theming" might mean for the Windows Terminal in v2.0 and beyond. Now that #3789 has merged into master, I figured it was time to discuss what customizing other elements of the UI might look like as well. I've tried to include as many configurable elements of the UI as I could, referencing a ton of threads across the repo.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

read the spec

TODO

  • What style syntax should we have for theme members? element.property or elementProperty?
  • This is the worst "Future Considerations" section I've ever written, so it might need some elaborating upon.
  • For future considerations: Should we allow the "set tab color" action to set the tab color to the terminal background? What value would that be?
  • How do we describe acrylic brushes? (I want the titlebar to be acrylic, 50% opacity, hue #ff00ff)? What about other potential materials? (vintage opacity?)
  • Does the user have to manually specify the color for the titlebar, and the find dialog BG, and the command palette BG, and the .... or is there some way they can just set all at once?

@zadjii-msft zadjii-msft added Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Area-User Interface Issues pertaining to the user interface of the Console or Terminal Product-Terminal The new Windows Terminal. labels May 6, 2020
@zadjii-msft zadjii-msft added this to the Terminal v1.x milestone May 6, 2020
@mdtauk
Copy link

mdtauk commented May 6, 2020

Can there be support for the Accent Color brushes, so if I were to set my cursor or selction to my Accent Color, as it changes, that change will be reflected in Windows Terminal?

@zadjii-msft
Copy link
Member Author

Can there be support for the Accent Color brushes, so if I were to set my cursor or selction to my Accent Color, as it changes, that change will be reflected in Windows Terminal?

So that might need to be it's own separate feature request. The cursor and the selection are drawn in DirectX down in TermControl, so they work differently than a lot of the things in this spec (which are all XAML elements).

For those, we'd need to accept something like "cursorColor": "accent". When we did that, CascadiaSettings would know that the string isn't a "#rrggbb" color, so it could look up the color when we're building the TerminalSettings to pass to the TermControl. However, after that point, if the user changes their accent color, that wouldn't be reflected dynamically in the Terminal, until the user manually refreshes their settings.

It's not a horrible idea, but probably something we should move to it's own thread for discussion, since I don't think it really fits in with a lot of the other things in this spec.

@mdtauk
Copy link

mdtauk commented May 6, 2020

@zadjii-msft I just assumed the ability to specify Xaml resources, would include the app getting the Accent Color resource to use for the UI. I do see that with the console rendering being a separate system, passing any Xaml brushes through, would be a different issue.

}
```

> **TODO FOR DISCUSSION**: I've given both a `tab.<property>` and a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally like the <element>.<property> representation more. I think it's more clear.

I'm probably in the minority here but I also love nested objects too. So, is there any consideration for...

<element>: 
{
  <property1>: <value1>,
  <property2>: <value2>
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ew, I hate the nested objects so much that I didn't even put them in here 😝 My preference is definitely leaning towards element.property

Comment on lines +196 to +202
* `key:SomeXamlKey` to try and look `SomeXamlKey` up from our resources as a
`Color`, and use that color for the value.
- TODO DISCUSSION: Does anyone want this?
- is `accent` just `key:SystemAccentColor`? If it is, is it a reasonable
alias that we'd want to provide anyways?
- TODO DISCUSSION: PR[#5280] suggested `{ "key": "SomeResourceKey" }` for
string resources, should we use that format for colors like this as well?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why key:SomeXamlKey as opposed to SomeXamlKey directly? We can just add valid enums. Then extensions can add more enums too. Maybe I'm just not understanding this part.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing the thread it was mentioned in now, but someone once suggested using "xaml:SomeXamlKey", and I really like that.

I think the "object" notation for looking up a key like this made it easier for us to say "this is an object, it's definitely not a string value". You're right though, these are just enums, so we can manually make sure that xaml: isn't used as a prefix for any of them.

Comment on lines +207 to +229
Using `terminalBackground` with multiple concurrent panes with different
backgrounds could certainly lead to some odd behavior. The intention of the
setting is to provide a way for the tab/titlebar to "seamlessly" connect to the
terminal content. However, two panes side-by-side could have different
background colors, which might have an unexpected appearance. Since the user
must have opted in to this behavior, they'll need to decide personally if
that's something that bothers them aesthetically. It's entirely possible that a
user doesn't use panes, and this wouldn't even be a problem for them.

<!-- We could maybe mitigate this by providing the user a way of specifying the
`tab.background` color as having both a "single pane" and "multiple pane" mode,
though I'm not sure I'm in love with this:

```json
"tab.background": {"single": "terminalBackground", "multiple": null},
"tab.background": {"single": "terminalBackground", "multiple": "#ff0000"},
"tab.background": [ "terminalBackground", null ]
```

Also shown is an array based implementation, as an option. Overall I'm not
happy with this, so I think it shouldn't be in the final draft of the spec, but
I'm leaving it for now as an option.
-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This alone could get its own spec hahaha. I think following the active terminal instance is good for now. I'm thinking of some weird behaviors we could do that I think just isn't worth dealing with in v1:

Scenario Behavior
vertical stack of panes (1) inherit top color
horizontal stack of panes (1) blend colors touching titlebar, (2) blend at pane separator

to use the tab color with some contrast applied" or just literally "Use
whatever the active tab's color is."

### Default Themes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Maybe worth mentioning in future considerations over v1) Should we consider a "defaults/list" structure like we did with profiles.defaults? For now, I'm guessing themes won't be too big, but over time that could become an issue (maybe)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See, I don't think we need a "defaults" for themes. People will only ever have one theme active at a time, for the entire window, so we don't really need to abstract that away.

The only reason I've got a whole list of themes is so:

  • In the future, people can use extensions to install multiple themes, and just pick one they like
  • People can iterate on ideas they like, and keep around old "themes" they create, even if they're using something else currently.

I think it's fine for each theme to be it's own atomic object, not composed of a (user theme defaults)+(changes to the user theme defaults)

Comment on lines +461 to +466
Are we concerned that by enabling theming, the appearance of the Terminal won't
be as static, and won't necessarily have as specific a look? It might be harder
for potential users see a screenshot of the Terminal and _know_ "Thats the
Windows Terminal". Is this something we're really all that concerned about
though? If this is something users want (it is), then shouldn't that be what
matters?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's where the defaults matter most (I'm guessing that's a conversation we'll have at some point too)

XAML fundamentally styles UI elements. If not provided, will use the default
value "system", which will use whatever the system's default theme is.

#### Theme Colors
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey something else we should consider - someone might want an acrylic titlebar, that's not the terminal BG color. This spec doesn't cover that case quite yet.

maybe "property": { "color": "#rrggbb", "opacity": .5 }?

Other lower-priority ideas:
* [ ] Enable hiding the tab icon altogether
* [ ] Enable forcing tab icons to monochrome
* [ ] Tab row height

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦙 The Tab width behavior would fit in here as well (Compact, Equal, SizeToContent).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's a good point. We'll need to come up with a way of handling what happens when the user has it set in both the theme and directly in the global settings - probably makes sense to just use the global value to override the theme value, right?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zadjii-msft or does it make sense to just move the setting itself into the theme (and have some default value if the theme doesn't provide one)? Or use the 'global' setting as the fallback value if the theme doesn't contain one?

DHowett pushed a commit that referenced this pull request Aug 7, 2020
This PR adds support for per-profile tab colors, in accordance with
#7134. This adds a single `tabColor` property, that when set, specifies
the background color for profile's tab. This color can be overridden by
the color picker, and clearing the color with the color picker will
revert to this default color set for the tab.

* Full theming is covered in #3327 & #5772 

Validation: Played with setting this color, both on launch and via
hot-reload

Specified in #7134
Closes #1337
@microsoft-github-updates microsoft-github-updates bot changed the base branch from master to main October 22, 2020 00:27
@mdtauk
Copy link

mdtauk commented Dec 12, 2020

I posted this in the UI Mega Thread, but was trying to trackdown the current issue handling Acrylic and Titlebars, so I am posting this here also...

Ignoring the Rounded Window Border (that will probably come to Windows with the new "Sun Valley" UI refresh) Here is how I would imagine a more immersive Terminal could look.
image
image

Edit:
image
Example with scrolled content

So the Titlebar uses the Console background - the Tabs blend in with an active tab standing out - and the Window Controls adapting their colour to contrast well.

@Shomnipotence
Copy link

As discussed in the following issue, there are too many ideas to achieve, including but not limited to the title bar, the current label, the hover label, the background color, and the different settings for the title bar. There is no doubt that it will eventually Import to build a theme system. My confusion lies in whether such a "grand" personalized setting system is needed for WindowsTerminal? I think I can sort out which parts can be prioritized (although Microsoft may not be interested in this).
#1963,#1337,#3061 / #3062,#2994

The Fluent Design System is constantly evolving, it is always in development, and less than 1/3 of the system applications adopt them, so Windows will never have a unified user interface, because the speed of applications using the latest design language will never keep up The speed of design updates. Moreover, before the release of WinUI3, I am afraid that all Win32 applications will not have much design changes-this is because Microsoft seems to be hesitant on whether to use XAML to build new applications.

Based on this, we discuss the design of Windows Terminal to minimize design changes and be compatible with existing designs as much as possible.

Windows Terminal allows you to set the background, but when the background uses acrylic, you will encounter an extremely ugly title bar (tab page bar), so the first consideration is to extend the acrylic effect to the title bar (tab page bar).

image

Here is a question, how to deal with the current label color, I personally think that the label color and the background of the current page can be consistent. If the current background color is a picture, the theme color will be automatically extracted from the picture.
If you do this, you only need to specify two colors:

Title bar color
Window background color (=label color)
WindowsTerminal1
WindowsTerminal2
WindowsTerminal5

There is another solution here, which I saw in the Files App, using a completely floating tab design.

In this case, the color of the title bar (tab page bar) is the same as the background color of the window. If a picture is used, the picture is tiled or full in the current window. Add a rounded rectangle background to the current label to show the selection, as shown in the figure.

WindowsTerminal3
WindowsTerminal4
WindowsTerminal6

I think these adjustments will not increase too much workload and are in harmony with Fluent Design. I want Microsoft to work as quickly as possible. I really look forward to Sun Valley, but so far, I think the biggest changes may be the "alarm and clock app" and the news flow of the taskbar.

@Stanzilla
Copy link
Contributor

@Shomnipotence love your first solution, that is pretty much perfect.

@ghost
Copy link

ghost commented May 28, 2021

There should be a tab.backgroundMode that sets when should the color be visible (all the time, hover+selection, selection).

@orcmid
Copy link

orcmid commented May 28, 2021

When there are two tabs, my eye goes to the prominent unselected tab. Determination of the foreground tab is too subtle in that case. If there were 3 tabs it might be more obvious about what tab is in the foreground. I suspect my eye can be trained, but that is worrisome.

Is there a way out of this that isn't complexifying?

Oh: If the rest of the tab bar (and other unselected tabs) were also the same as the shown unselected tab, I would have no doubt about which tab is in the foreground. Maybe distinguished with or without acryic.

@zadjii-msft zadjii-msft removed this from the Terminal v2.0 milestone Jul 7, 2021
@zadjii-msft
Copy link
Member Author

I'm closing this for now. There's been no movement for a while, and we're not planning on landing this inside 2.0 anymore. Plus, #10509 definitely complicates the design a bit. Might as well not leave this stale PR open for so long. I'll come back to it in the future.

@zadjii-msft zadjii-msft closed this Jul 7, 2021
@matthew4850 matthew4850 mentioned this pull request Aug 3, 2021
1 task
@zadjii-msft zadjii-msft added Area-Theming Anything related to the theming of elements of the window and removed Area-User Interface Issues pertaining to the user interface of the Console or Terminal labels Aug 4, 2021
@PuruVJ
Copy link

PuruVJ commented Aug 10, 2021

Hi is this implemented yet? 😅

@zadjii-msft
Copy link
Member Author

@PuruVJ Nope. This was a proposal for how we might want to do this in the future, but I've temporarily closed this out because

  1. the team won't have enough time to give it a proper review anytime soon
  2. it needs a little reworking for Mica (Add support for the Mica material #10509).

This is my pet project for 3.0, but alas, it didn't end up making the cut for 2.0.

@PuruVJ
Copy link

PuruVJ commented Aug 10, 2021

Thanks!! Makes sense

ghost pushed a commit that referenced this pull request Aug 23, 2021
Add support for acrylic in the titlebar

## PR Checklist
* [x] CLA signed
## Detailed Description of the Pull Request / Additional comments
This seems to be a highly requested feature and seeing as #5772 was closed I thought it made sense to make a PR for this.
![image](https://user-images.githubusercontent.com/40522069/128095309-f9073a9d-274c-44a1-be5b-34ea58d5a5a9.png)

## Validation Steps Performed
Checked that acrylic works in both dark and light modes and switching between them still works. Also checked that acrylic in the tab row still works when tabs in titlebar is disabled.
@zadjii-msft zadjii-msft mentioned this pull request Sep 14, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Theming Anything related to the theming of elements of the window Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants