# Themes

Use DsWord to customize the themes applied to a Word document by changing the theme font and colors. Learn more in DsWord docs.

## Content

Themes, in a Word document, helps in making the global formatting changes, giving your document a consistent and professional look. Hence, themes are generally used to reinforce a brand across every document that is generated by a business.
DsWord allows you to customize the themes applied to a Word document through the [Theme](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Theme.html) class which can be accessed using [Theme](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.GcWordDocument.Theme.html) property of the [GcWordDocument](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.GcWordDocument.html) class. The **Theme** class saves the font and colors that would be used in the document using the [FontScheme](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Theme.FontScheme.html) and [ColorScheme](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Theme.ColorScheme.html) properties.
The theme font can be set using the **FontScheme** property of the Theme class. This property is of type [FontScheme](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.FontScheme.html) class which provides the [MajorFont](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.FontScheme.MajorFont.html) and [MinorFont](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.FontScheme.MinorFont.html) properties to specify the font for heading and body respectively.
And, to set the theme colors you would need to fetch the theme color scheme using the [GetThemeColor](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Settings.GetThemeColor.html) method of the [Settings](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Settings.html) class which accepts the [ThemeColorId](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ThemeColorId.html) as a parameter. This method returns an instance of the [ThemeColor](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ThemeColor.html) class, which provides the **RGB** property to set the value of a color in the color scheme of the theme.
To change the theme color and font in a Word document:

1. Access the color scheme of the document using **GetThemeColor** method of the **Settings** class.
2. Set the value of a color in the color scheme of the theme using the RGB property of the ThemeColor class. For example, set dark
    orange color for Accent1 theme color and dark blue color for the hyperlink theme color.
3. Access the font scheme for the document using **FontScheme** property of the Theme class.
4. Set the theme font for heading and body of the document using the [Name](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ThemeFont.Name.html) property of the [ThemeFont](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ThemeFont.html) class.

    ```csharp
    GcWordDocument doc = new GcWordDocument();
    var section = doc.Body.Sections.First;
    
    //Add Heading
    section.GetRange().Paragraphs.Add("Working with Themes",
              doc.Styles[BuiltInStyleId.Heading1]);
    
    //Add the first paragraph          
    var p = section.GetRange().Paragraphs.Add(
        "This sample shows how you can access and manipulate" +
        " the document theme properties." +
        " For more information, refer to ");
    
    //Add a hyperlink
    Hyperlink link1 = p.GetRange().Hyperlinks.Add(
     new Uri("https://www.google.co.in/"),
             "", "Google");
    
    //Customizing the color scheme(theme colors) of the document.
    //Setting the Accent1 theme color
    doc.Settings.GetThemeColor[ThemeColorId.Accent1].RGB = Color.DarkOrange;
    
    //Setting the Hyperlink theme color
    doc.Settings.GetThemeColor[ThemeColorId.Hyperlink].RGB = Color.DarkBlue;
    
    //Setting the FollowedHyperlink theme color
    doc.Settings.GetThemeColor[ThemeColorId.FollowedHyperlink].RGB = Color.DarkGray;
    
    //Customizing the font scheme(theme fonts) of the document
    //Setting Major(Heading) theme font for Latin characters
    doc.Theme.FontScheme.MajorFont.Latin.Name = "Calibri";
    
    //Setting Minor(Body) theme font for Latin characters
    doc.Theme.FontScheme.MinorFont.Latin.Name = "Century Gothic";
    
    //Saves the document
    doc.Save("Themes.docx");
    ```

For more information on how to modify theme colors using DsWord, see [DsWord sample browser](https://developer.mescius.com/documents-api-word/demos/).