setTheme(theme)
Changes the background of CommandBar experiences to the supplied theme (like a light mode or dark mode).
Example
// using a hex color
window.CommandBar.setTheme("#4242cb");
// using a skin slug
window.CommandBar.setTheme("blinding-lights");
window.CommandBar.setTheme("matrix-vibes");
// using a CommandBar default
window.CommandBar.setTheme("light");
window.CommandBar.setTheme("dark");
Method parameters
theme Required
string | 'light' | 'dark'
A hex color or skin slug. Using 'light' or 'dark' will trigger CommandBar's default light or dark theme.