How to use the @microsoft/load-themed-styles.loadTheme function in @microsoft/load-themed-styles

To help you get started, we’ve selected a few @microsoft/load-themed-styles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OfficeDev / office-ui-fabric-react / packages / styling / src / styles / theme.ts View on Github external
export function loadTheme(theme: IPartialTheme, depComments: boolean = false): ITheme {
  _theme = createTheme(theme, depComments);

  // Invoke the legacy method of theming the page as well.
  legacyLoadTheme({ ..._theme.palette, ..._theme.semanticColors, ..._theme.effects, ..._loadFonts(_theme) });

  Customizations.applySettings({ [ThemeSettingName]: _theme });

  _onThemeChangeCallbacks.forEach((callback: (theme: ITheme) => void) => {
    try {
      callback(_theme);
    } catch (e) {
      // don't let a bad callback break everything else
    }
  });

  return _theme;
}
github OfficeDev / office-ui-fabric-react / src / demo / pages / ThemePage / ThemePage.tsx View on Github external
private _onColorChanged(index: number, newColor: string) {
    let { colors } = this.state;
    let color = colors[index];
    let theme: ITheme = {};

    color.value = newColor;

    for (let i = 0; i < colors.length; i++) {
      let themeColor = colors[i];

      theme[themeColor.key] = themeColor.value;
    }

    loadTheme(theme);

    // The theme has changed values, but color state is the same. Force an update on the list.
    this.refs.list.forceUpdate();
  }
github OfficeDev / office-ui-fabric-react / packages / styling / src / styles / theme.ts View on Github external
export function loadTheme(theme: IPartialTheme): ITheme {
  _theme = createTheme(theme);

  // Invoke the legacy method of theming the page as well.
  legacyLoadTheme({ ..._theme.palette, ..._theme.semanticColors });

  GlobalSettings.setValue(ThemeSettingName, _theme);

  return _theme;
}
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / demo / pages / ThemePage / ThemePage.tsx View on Github external
private _onColorChanged(index: number, newColor: string) {
    let { colors } = this.state;
    let color = colors[index];
    let theme: ITheme = {};

    color.value = newColor;

    for (let i = 0; i < colors.length; i++) {
      let themeColor = colors[i];

      theme[themeColor.key] = themeColor.value;
    }

    loadTheme(theme);

    // The theme has changed values, but color state is the same. Force an update on the list.
    this.refs.list.forceUpdate();
  }
github s-bauer / office-ui-fabric-vue / packages / styling / src / styles / theme.ts View on Github external
export function loadTheme(theme: IPartialTheme, depComments: boolean = false): ITheme {
    _theme = createTheme(theme, depComments);

    // Invoke the legacy method of theming the page as well.
    legacyLoadTheme({..._theme.palette, ..._theme.semanticColors});

    Customizations.applySettings({[ThemeSettingName]: _theme});

    _onThemeChangeCallbacks.forEach((callback: (theme: ITheme) => void) => {
        try {
            callback(_theme);
        } catch (e) {
            // don't let a bad callback break everything else
        }
    });

    return _theme;
}

@microsoft/load-themed-styles

Loads themed styles.

MIT
Latest version published 9 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages