// This code is part of GrapeCity Documents for Word samples.
// Copyright (c) GrapeCity, Inc. All rights reserved.
using System;
using System.Drawing;
using System.IO;
using GrapeCity.Documents.Word;
using GrapeCity.Documents.Imaging;

namespace GcWordWeb.Samples
    // This sample demonstrates how to use theme colors
    // to change how a document looks.
    public class ThemeColors
        public GcWordDocument CreateDocx()
            var doc = new GcWordDocument();
            var path = Path.Combine("Resources", "WordDocs", "BuiltInStyles.docx");

            // Note: prior to v2sp2 release of GcWord, theme colors could be modified
            // directly via GcWordDocument.Theme. In v2sp2 GlossaryDocument was added.
            // GcWordDocument and GlossaryDocument are derived from the same DocumentBase
            // class. Each can have their own theme colors, but there is still only one
            // Theme object, thus specific theme colors should be defined via Settings.
            // So instead of code like this:
            //   doc.Theme.ColorScheme[ThemeColorId.Text1].RGB = Color.Blue;
            // now the following code should be used to modify the theme colors
            // used in the document:

            doc.Settings.GetThemeColor(ThemeColorId.Text1).RGB = Color.Blue;
            doc.Settings.GetThemeColor(ThemeColorId.Accent1).RGB = Color.Red;
            doc.Settings.GetThemeColor(ThemeColorId.Accent2).RGB = Color.OrangeRed;
            doc.Settings.GetThemeColor(ThemeColorId.Accent3).RGB = Color.Orange;

            // Done:
            return doc;