articles

Home / DeveloperSection / Articles / Create and Apply a Theme in SharePoint

Create and Apply a Theme in SharePoint

Chris Anderson7512 06-Dec-2011

In this article I am going to explain and show you how to create and customize the theme with the help of PowerPoint and apply it in the SharePoint Site. I also demonstrate how to apply the theme programmatically in SharePoint.

Follow these steps to create a Theme:
  • Open Microsoft PowerPoint 2010.
  • Go to Design Tab.
  • Click the drop down arrow in colors.
  • Click on "Create New Theme Colors".

Create and Apply a Theme in SharePoint

  •  Choose the Theme colors as per your requirement.
  • · Enter the Name and click on Save.

Create and Apply a Theme in SharePoint

    • Go to File =>Save As type. 
    • Enter File Name as MyTheme. 
    • Choose Office Theme in Save As Type.
    • Click on Save.

    Create and Apply a Theme in SharePoint

    • Open the SharePoint Site.
    • Go to Site Actions =>Site Settings => Galleries => Themes.

    Create and Apply a Theme in SharePoint

    Create and Apply a Theme in SharePoint

    ·         Click Add new item and browse your theme and add the theme file that we have created.

    Create and Apply a Theme in SharePoint

    After adding a theme you have to apply it in the SharePoint Server:

    ·         Go to Site Actions => Site Settings => Look and Feel => Site Theme.

    Create and Apply a Theme in SharePoint

    ·         Select the theme which we have created and Click on Apply to apply the theme in the SharePoint Server.

    Create and Apply a Theme in SharePoint

    The sites look like the following:

    Create and Apply a Theme in SharePoint

    Now you have to apply the theme programmatically in the SharePoint Site:

    1)    Open Visual Studio and create a Console Application.

     

    Create and Apply a Theme in SharePoint

    Write the below code in the Program.cs file:

    using System;
    
    using System.Text;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Utilities;
    using System.Collections.ObjectModel;

    namespace ApplyThemeinSharePoint
    {
        class Program
        {
            static void Main(string[] args)
            {
                using (SPSite objSite = new SPSite("http://rohit:34143/"))
                {
                    using (SPWeb objWeb = objSite.OpenWeb())
                    {
                        ReadOnlyCollection<ThmxTheme> objThemeList;
                        objThemeList = ThmxTheme.GetManagedThemes(objSite);
                        foreach(ThmxTheme objThmx in objThemeList)
                        {
                            if (objThmx.Name == "Berry")
                            {
                                ThmxTheme.SetThemeUrlForWeb(objWeb,
                                                            objThmx.ServerRelativeUrl);
                                break;
                            }
                        }
                    }
                }
                Console.WriteLine("Berry Theme applied in the SharePoint Site");
            }
        }
    }

      Output:

    Create and Apply a Theme in SharePoint

    Now you can see in your SharePoint site Berry Theme is applied. Now the site looks like the following:

    Create and Apply a Theme in SharePoint

    Thanks for reading this article. After reading this article you can easily create the theme with help of PowerPoint and can also apply the theme in the SharePoint site.


    Updated 07-Sep-2019
    hi I am software developer at mindstick software pvt. ltd.

    Leave Comment

    Comments

    Liked By