I am starting a new SharePoint online project, and the first requirement that came in is to build a POC site for the customer, but they want to define a custom Fonts and Colors for the site to meet their standards.. so is this possible inside SharePoint modern UI ? to define custom fonts and Colors other than the build-in features provided by the Sitting>> Change the Look.. which does have a coloring options but does not have any options to change the font.


  • My answer doesn't work for you ? I tested multiple times and it's working fine Oct 26, 2021 at 9:07
  • 1
    John. If possible, avoid changing the fonts. If your company or clients ask for it - try to push back. We tried changing fonts before and you will start all sorts of issues. For example, there are icon fonts you will break. You will also break the text editor webpart's fonts and a lot of other places. Instead, simply list to the clients the official supported customizations. For example, custom themes. Oct 28, 2021 at 23:49
  • @DenisMolodtsov this is sound like a wise advice .. thank you..
    – John John
    Oct 29, 2021 at 17:17

2 Answers 2


Well I have faced that situation months ago where I had to apply some branding things for SharePoint Online modern pages. So here is my results from my investigations (which I already applied and it's working fine)

  • First of all, You need to know that Microsoft doesn't support injecting or adding alternate CSS or JS or any other OOTB way to apply some custom styling in SPO
  • Even using classic themes in mdern pages doesn't change the font and the color palette.
  • So if you want to brand your site with your personalized specific font and styles you need to Create a customised theme


To do this, you can use the following steps :

  1. First step : Using The Theme Generator offered by Microsoft, start creating your suitable font and color combination. Once you are done copy the output generated in the "Output" page and choose "PowerShell"

enter image description here

  1. Second step : using the following PowerShell script, and having the required admin permissions this code will get the job done :

Here fill the information about your tenant

$adminUPN="[email protected]"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential

Themepalette gotten from Theme Generator

$themepalette = @{
"themePrimary" = "#0078d4";
"themeLighterAlt" = "#eff6fc";
"themeLighter" = "#deecf9";
"themeLight" = "#c7e0f4";
"themeTertiary" = "#71afe5";
"themeSecondary" = "#2b88d8";
"themeDarkAlt" = "#106ebe";
"themeDark" = "#005a9e";
"themeDarker" = "#004578";
"neutralLighterAlt" = "#f8f8f8";
"neutralLighter" = "#f4f4f4";
"neutralLight" = "#eaeaea";
"neutralQuaternaryAlt" = "#dadada";
"neutralQuaternary" = "#d0d0d0";
"neutralTertiaryAlt" = "#c8c8c8";
"neutralTertiary" = "#c2c2c2";
"neutralSecondary" = "#858585";
"neutralPrimaryAlt" = "#4b4b4b";
"neutralPrimary" = "#333333";
"neutralDark" = "#272727";
"black" = "#1d1d1d";
"white" = "#ffffff";

Add the theme to SharePoint Online

Add-SPOTheme -Identity "Custom-Theme" -Palette $themepalette -IsInverted $false
  1. Third step : Now go to your SharePoint site and apply the new theme

MORE DETAILS : https://sharepointmaven.com/how-to-configure-and-apply-a-custom-theme-in-sharepoint-online/

Font & Typography

SharePoint Framework Extension Application Customizer is your solution

Using it, you can inject custom css to SP modern pages and luckily Microsoft already listed that on the official documentation (I hope you have some experience using SPFx because it's required)

  1. First step : Download your font and copy it to your SPFx extension project using the following code

    @import ‘https://fonts.googleapis.com/css?family=PT+Sans|PT+Sans+Caption|PT+Sans+Narrow’;

  2. Second step : use this in your application customizer SCSS file

Then you can use the font like: font-family: ‘PT Sans Caption’, sans-serif;

  1. Third step : use the CSS Selectors to find out the areas where you want to change the font style and apply your CSS customisation :

    font-size: 40pt; color: orangered; font-weight: bold; font-family: 'PT Sans Caption', sans-serif;

  2. Fourth step : Debug and test your code

  3. Fivth step : Deploy it (depending on your need, you can choose the level where this customisation should be deployed "tenant, site collection or any level)

You can check here (SPFx Applications Customiser CSS Injection) for more details

Please accept the answer if it works.

  • 1
    thanks a lot for the helpful reply.. but can you advice more on how i can use the Theme generator @ developer.microsoft.com/en-us/fluentui#/styles/web? second question, you mentioned that injecting custom CSS is not supported while in your approach to apply custom "Font & Typography" you are injecting custom CSS.. so does this mean that your approach for applying custom "Font & Typography" is not supported by Microsoft? thanks
    – John John
    Oct 26, 2021 at 10:31
  • 1
    For the first question, I expect that you will ask this one, well check here SharePoint Maven has already make full details of that sharepointmaven.com/… Oct 26, 2021 at 12:27
  • 1
    For the second question, what I meant in first place you cannot inject cusom css in "Code Snippet" OOTB SharePoint WebPart, this is why you need to develop your own one with SPFx and deploy it as a package on your app catalog Oct 26, 2021 at 12:32
  • 1
    thanks for your reply ..so you mean injecting custom CSS using SPFX web part is supported? what if Microsoft apply an update and changed the CSS markup, then the injected CSS might stop working or might cause issues.. am i correct?
    – John John
    Oct 26, 2021 at 17:13
  • It depends on your type of customisation, however most of time MS Updates will still work for your SPFx packages Oct 27, 2021 at 7:54

Yes. You need to create a new theme. Color palette and fonts.


You will need to export the theme, change it, then import it again.


In Powershell, run this:

Connect-SPOService -Url https://yourtenant.sharepoint.com

Enter your central admin credentials.


Now, define a variable and assign the JSON to it:

$themepalette = [paste the code here]

Next, run the Add-SPOTheme commandlet: Add-SPOTheme

-Name "Your Theme Name" -Palette $themepalette -IsInverted $false T

You can access it from the “Change the look” panel.

This will only change colors, not fonts in modern pages. If you want to change fonts, you'll need to follow the link from the above url and do css injection.

Here's the project:


  • thanks for the reply.. but have u tried this approach before? and is it recommended by Microsoft?
    – John John
    Sep 21, 2021 at 16:29
  • 1
    @johnGu I have tried it and I have done it before. It is the only way to put custom colors and fonts Online. It requires some development and can't be done out of the box. Previously, you could just upload master page using css, but Online is a bit more stringent about that. Some sharepoint links that could help you in your task: social.technet.microsoft.com/wiki/contents/articles/…
    – jo1storm
    Sep 22, 2021 at 6:24
  • so will this approach allow us to change the default fonts ? or it is mainly used for changing the color?
    – John John
    Sep 22, 2021 at 9:56
  • 1
    You can change both fonts and colors by making a custom theme and site template. It is mostly used to change colors, though, but it is a recommended way to change the fonts on the whole site.
    – jo1storm
    Sep 22, 2021 at 9:57
  • ok thanks will try this and let you know if i face any issues
    – John John
    Sep 22, 2021 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.