-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fluent: add dark theme support #5138
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we try something real? I am unsure if this can be easily done because how Fluent package their stuff...
Let's see if you can do this. Load @fluentui/theme
(from unpkg.com?) and render the actual theme provider before us. So we can see the E2E of this user story: "Web Chat theme can be using defaults from Fluent UI."
Then turn on the dark theme. I think Fluent component should honor that and set the CSS properly.
To turn on dark theme, you can search in some of our HTML tests. I forgot which HTML test, search "prefers-color-scheme". It could be related to keyboard help screen.
To turn on dark theme, you can look at this keyboard help screen test,
https://github.com/microsoft/BotFramework-WebChat/tree/main/__tests__/html/accessibility.keyboardHelp.darkTheme.html#L17.
Particularly, send setEmulatedMedia
CDP command over WebDriver. 😉
await host.sendDevToolsCommand('Emulation.setEmulatedMedia', {
features: [{ name: 'prefers-color-scheme', value: 'dark' }]
});
I was hoping to use the Fluent infrastructure too, but I haven't found a reliable way to bundle Fluent, unless we want to maintain the ESM build ourselves. I'm blocked on <script type="importmap">
{
"imports": {
"@fluentui/theme": "https://unpkg.com/@fluentui/[email protected]/lib/index.js",
"@fluentui/merge-styles": "https://unpkg.com/@fluentui/[email protected]/lib/index.js",
"@fluentui/utilities": "https://unpkg.com/@fluentui/[email protected]/lib/index.js",
"@fluentui/dom-utilities": "https://unpkg.com/@fluentui/[email protected]/lib/index.js",
"@fluentui/set-version": "https://unpkg.com/@fluentui/[email protected]/lib/index.js",
"tslib": "https://unpkg.com/[email protected]/tslib.es6.mjs"
}
}
</script>
<script type="module">
import('@fluentui/theme').then(mod => {
console.log(mod);
})
</script> And I probably can work around @compulim please let me know if you have a better idea, or if you think it's worth to continue. |
No problems. I expect this outcome too. After you finish all P0s, please try to build our own bundle with |
Changelog Entry
botframework-webchat-fluent-theme
package for applying Fluent UI theme to Web Chat, by @compulim and @OEvgenyDescription
PR adds styles needed to support dark themes. Mostly overriding user-agent styles with our or Fluent defaults (when Fluent theme is provided).
Design
Note that the
fluent-theme
package doesn't inherit thestyleOptions
colors. Instead, it defaults to the provided by Fluent CSS variables.Specific Changes
fill
attribute from SVG elements-
CHANGELOG.md
Review Checklist
z-index
)package.json
andpackage-lock.json
reviewed