Fluentui: [Question] How to replace the global color palette with other defaults?

Created on 31 Aug 2017  ·  7Comments  ·  Source: microsoft/fluentui

In your website you say

The entire color pallete of the controls are themeable. We provide a set of sensible defaults.

How can we set a different default theme ? without overriding all colors individually.
Thank you

Question ❔

Most helpful comment

These docs should probably be pushed to the website as well, you can find them if you clone the repo, npm start, and click on "Themes"


Themes

The entire color pallete of the controls are themeable. We provide a set of sensible defaults, but you can override all colors individually.

To override the themes, you need to call loadTheme() with the appropriate set of overrides:

import { loadTheme } from 'office-ui-fabric-react/lib/Styling';

loadTheme({
  palette: {
    'themePrimary': 'red'
  }
});

All 7 comments

These docs should probably be pushed to the website as well, you can find them if you clone the repo, npm start, and click on "Themes"


Themes

The entire color pallete of the controls are themeable. We provide a set of sensible defaults, but you can override all colors individually.

To override the themes, you need to call loadTheme() with the appropriate set of overrides:

import { loadTheme } from 'office-ui-fabric-react/lib/Styling';

loadTheme({
  palette: {
    'themePrimary': 'red'
  }
});

Wow- this is a really powerful feature that should definitely be included in the public documentation

@lynamemi is this something you'd be able to get on our public website? It's already in the developer docs.

This documentation is already on the site under https://dev.office.com/fabric#/components/themes. Would it be useful to link to it from the colors page as well?

@Jahnp yes- of course!!

Google directed me to this github issue today when trying to find out how to customise a fabric ui palette. That indicates that the official documentation is not discoverable enough, and could do with a few inbound links.

Got it on my todo list!

Was this page helpful?
0 / 5 - 0 ratings