How to use @microsoft/load-themed-styles - 10 common examples

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 / monaco-editor / tasks / transformCssTask.js View on Github external
function createEsm(css) {
  const { splitStyles } = require('@microsoft/load-themed-styles');

  // Create a source file.
  const source = [
    `/* tslint:disable */`,
    `import { loadStyles } from \'@microsoft/load-themed-styles\';`,
    `loadStyles(${JSON.stringify(splitStyles(css))});`
  ];

  return source.join('\n');
}
github microsoft / roosterjs-react / tools / scss.js View on Github external
function createTypeScriptModule(fileName, css) {
    const { splitStyles } = require("@microsoft/load-themed-styles");

    // Create a source file.
    const source = [
      `/* tslint:disable */`,
      `import { loadStyles } from \'@microsoft/load-themed-styles\';`,
      `loadStyles(${JSON.stringify(splitStyles(css))});`
    ];

    const map = _fileNameToClassMap[fileName];

    for (let prop in map) {
      source.push(`export const ${prop} = "${map[prop]}";`);
    }

    return source.join('\n');
}
github OfficeDev / office-ui-fabric-react / scripts / tasks / sass.js View on Github external
function createTypeScriptModule(fileName, css) {
  const { splitStyles } = require('@microsoft/load-themed-styles');

  // Create a source file.
  const source = [
    `/* tslint:disable */`,
    `import { loadStyles } from \'@microsoft/load-themed-styles\';`,
    `loadStyles(${JSON.stringify(splitStyles(css))});`
  ];

  const map = _fileNameToClassMap[fileName];

  for (let prop in map) {
    source.push(`export const ${prop} = "${map[prop]}";`);
  }

  return source.join('\n');
}
github OfficeDev / office-ui-fabric-react / scripts / just-tasks / sass.js View on Github external
function createTypeScriptModule(fileName, css) {
  const { splitStyles } = require('@microsoft/load-themed-styles');

  // Create a source file.
  const source = [
    `/* tslint:disable */`,
    `import { loadStyles } from \'@microsoft/load-themed-styles\';`,
    `loadStyles(${JSON.stringify(splitStyles(css))});`
  ];

  const map = _fileNameToClassMap[fileName];

  for (let prop in map) {
    source.push(`export const ${prop} = "${map[prop]}";`);
  }

  return source.join('\n');
}
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;
}
github Puzzlepart / spfx-solutions / Pzl.Ext.StatusBar / src / extensions / modernSiteStatusbar / ModernSiteStatusbarApplicationCustomizer.ts View on Github external
private async render(): Promise {
        // Make sure all messages are shown on one line
        loadStyles(`#${this.properties.messageId} > DIV {float:left;margin-right:15px;}`);

        let targetNode = document.getElementById(this.properties.messageId);
        if (!targetNode) {
            // Make sure message element is present - if not create it
            targetNode = document.createElement("DIV");
            targetNode.id = this.properties.messageId;
            document.body.appendChild(targetNode);
        }

        if (!_topPlaceholder) {
            _topPlaceholder = this.context.placeholderProvider.tryCreateContent(PlaceholderName.Top, { onDispose: this._onDispose });

            // Hide placeholder if there is no text in it
            _topPlaceholder.domElement.style.cssText = targetNode.innerText.length > 0 ? "" : "display:none"

            _topPlaceholder.domElement.innerHTML = `

@microsoft/load-themed-styles

Loads themed styles.

MIT
Latest version published 12 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages