SharePoint office 365 Preview Theme on page load

Sushrut Paranjape 61 Reputation points
2021-06-18T12:01:01.683+00:00

Hello,

In SharePoint Office 365 we can preview a theme using Change the look -> Theme -> Clicking the Theme name gives us Preview of the Theme. However if we get out of the panel the theme is reverted and default theme colors take effect.

Is there a way we can apply a particular available theme on page load may be by using SPFx web part/extension? And if user do not want that theme they just click a button that will revert to original theme.

So basically need a way to show preview of a particular theme by default on page.

Is this possible? If yes, how can I do this?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,685 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,971 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,031 Reputation points
    2021-06-21T06:34:04.88+00:00

    Hi @Sushrut Paranjape ,

    As far as I know, there is no such way to apply a particular theme on page load. Applying theme is on site level.

    We could only get the current theme properties and use it in spfx customizations, you could refer to this article for more: https://video2.skills-academy.com/en-us/sharepoint/dev/spfx/use-theme-colors-in-your-customizations

    Besides, the spfx Theme Manager would be helpful to you: https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/js-theme-manager


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Sushrut Paranjape 61 Reputation points
    2021-06-22T14:50:28.99+00:00

    Thank you Michael!

    Is there a way we can trigger the Theme preview functionality from SPFx? Like when we click on the radio button we see the preview of the theme.

    108127-image.png


  2. Sushrut Paranjape 61 Reputation points
    2021-06-24T16:38:59.03+00:00

    Thank you @MichaelHan-MSFT !


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.