# Themes, Colors, and Icons

> Color the Windows Forms TextControl and ribbon with DisplayColors and BackgroundStyle, and tint ribbon icons for your own buttons with ResourceProvider.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for Windows Forms > Document Editor > Ribbon and UI > Themes, Colors, and Icons
- **3249 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/themes/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/themes/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/themes/llms-full.txt

---

To match TX Text Control to the look of your application, you set colors and pick icons rather than switch a theme. Every visible control of TX Text Control .NET for Windows Forms has a `DisplayColors` property that takes a set of colors, and by default these colors follow the colors of the Windows system. The icons of the ribbon are available to your own buttons at any resolution, and color icons can be tinted. The sections below cover both.

### What Can Be Colored

| Control | Property | Colors class | What it colors |
|---|---|---|---|
| `TextControl` | [DisplayColors](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/displaycolors-property/llms-full.txt) | [TextControl.Colors](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol-colors/llms-full.txt) | The area around the pages, the page shadows, header and footer marks and form field highlighting |
| `Ribbon` | [DisplayColors](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbon/displaycolors-property/llms-full.txt) | [Ribbon.Colors](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbon-colors/llms-full.txt) | Tabs, the application menu and the menus of the ribbon |
| `RulerBar` | [DisplayColors](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/rulerbar/displaycolors-property/llms-full.txt) | `RulerBar.Colors` | The rulers |
| `StatusBar` | [DisplayColors](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/statusbar/displaycolors-property/llms-full.txt) | `StatusBar.Colors` | The status bar |
| `ButtonBar` | [DisplayColors](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/buttonbar/displaycolors-property/llms-full.txt) | `ButtonBar.Colors` | The classic toolbar and its buttons |

Two more properties color single parts: [ContextualTabGroup.BackColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/contextualtabgroup/backcolor-property/llms-full.txt) sets the background of the label of a contextual tab group such as **Table Tools**, and [Sidebar.TitleForeColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms/sidebar/titleforecolor-property/llms-full.txt) the text color of a sidebar's title bar, by default the ARGB value (255, 43, 87, 154).

All `Colors` classes work the same way: you create an instance with `new`, set the colors you want and assign it to `DisplayColors`. Colors you leave unset are reset to their defaults when the object is assigned. The colors of the rulers and the status bar are described in [Rulers and Status Bar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/rulers-status-bar/llms-full.txt), those of the button bar in [Toolbars and Mini Toolbars](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/toolbars/llms-full.txt).

### Color the Editor

In page view, the [BackgroundStyle](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/backgroundstyle-property/llms-full.txt) property decides where the colors of the page background come from:

| Value | Page background |
|---|---|
| `ColorScheme` | The color scheme of the system, or the colors set with `DisplayColors` |
| `ClassicColors` | Dark gray |

The setting has an effect only when [ViewMode](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/viewmode-property/llms-full.txt) is `ViewMode.PageView`. The following code in *Form1.cs* gives the editor a dark area around the pages and changes the highlighting of form fields:

```csharp
using System;
using System.Drawing;
using System.Windows.Forms;
using TXTextControl;

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        Load += Form1_Load;
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        textControl1.ViewMode = ViewMode.PageView;

        // Use the colors of DisplayColors for the page background
        textControl1.BackgroundStyle = BackgroundStyle.ColorScheme;

        TextControl.Colors colors = new TextControl.Colors();
        colors.DesktopColor = Color.FromArgb(64, 64, 64);
        colors.DarkShadowColor = Color.Black;
        colors.FormFieldColor = Color.LightYellow;
        colors.ActiveFormFieldColor = Color.Gold;

        textControl1.DisplayColors = colors;
    }
}
```

The code works as follows:

- [DesktopColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol-colors/desktopcolor-property/llms-full.txt) is the area around the pages. [DarkShadowColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol-colors/darkshadowcolor-property/llms-full.txt) and [LightShadowColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol-colors/lightshadowcolor-property/llms-full.txt) are the shadows at the right and bottom and at the left and top edges of the pages.
- [FormFieldColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol-colors/formfieldcolor-property/llms-full.txt) highlights form fields, and [ActiveFormFieldColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol-colors/activeformfieldcolor-property/llms-full.txt) the form field with the input position. `Color.Transparent` switches the highlighting off.
- [HeaderFooterLabelColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol-colors/headerfooterlabelcolor-property/llms-full.txt) and [HeaderFooterLineColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol-colors/headerfooterlinecolor-property/llms-full.txt), not set here, color the label of an activated header or footer and its dividing line.
- [ResetDisplayColors](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/resetdisplaycolors-method/llms-full.txt) returns all colors to their system-dependent defaults.

The color of the text itself and of its background are formatting attributes of the document, not display colors; see [Character and Paragraph Formatting](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/formatting/llms-full.txt).

### Color the Ribbon

The ribbon connected to the `TextControl` is available through the [Ribbon](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/ribbon-property/llms-full.txt) property. Its colors default to system colors. Add these lines to the `Load` handler above:

```csharp
TXTextControl.Windows.Forms.Ribbon.Ribbon.Colors ribbonColors =
    new TXTextControl.Windows.Forms.Ribbon.Ribbon.Colors();
ribbonColors.ApplicationMenuTabColor = Color.FromArgb(0, 99, 177);
ribbonColors.HighlightTabColor = Color.FromArgb(0, 99, 177);

// The property is null when no ribbon is connected
if (textControl1.Ribbon != null)
{
    textControl1.Ribbon.DisplayColors = ribbonColors;
}
```

`Ribbon.Colors` has these properties:

| Property | Color of |
|---|---|
| [TabColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbon-colors/tabcolor-property/llms-full.txt) | The background of a ribbon tab |
| [HighlightTabColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbon-colors/highlighttabcolor-property/llms-full.txt) | A selected tab |
| [ApplicationMenuTabColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbon-colors/applicationmenutabcolor-property/llms-full.txt) | The first tab, which opens the application menu (the **File** tab) |
| [ApplicationMenuTabHighlightColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbon-colors/applicationmenutabhighlightcolor-property/llms-full.txt) | The first tab while the mouse pointer is over it |
| [ApplicationMenuColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbon-colors/applicationmenucolor-property/llms-full.txt) | The background of the application menu |
| [MenuColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbon-colors/menucolor-property/llms-full.txt) | The menus of the ribbon |

[Built-in Ribbon Tabs](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/ribbon/llms-full.txt) describes the ribbon itself.

### Use the Icons of TX Text Control

The static methods of the [ResourceProvider](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms/resourceprovider/llms-full.txt) class return the icons, texts, tooltips and key tips of the built-in ribbon tabs and toolbars. Your own buttons can use them to look like the built-in ones. An item is identified by a string, the name of a value of the item enumerations of the ribbon tabs or of the `ResourceProvider`, such as `TXITEM_Print` or `TXITEM_TextColor`.

[GetSmallIcon](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms/resourceprovider/getsmallicon-method/llms-full.txt) and [GetLargeIcon](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms/resourceprovider/getlargeicon-method/llms-full.txt) return a `System.Drawing.Bitmap` for a resolution given in DPI or taken from a control. An [ImageSourceSettings](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms/resourceprovider-imagesourcesettings/llms-full.txt) object adds options:

- [FillColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms/resourceprovider-imagesourcesettings/fillcolor-property/llms-full.txt) and [StrokeColor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms/resourceprovider-imagesourcesettings/strokecolor-property/llms-full.txt) change the color rectangle of color icons such as `TXITEM_TextColor`, `TXITEM_TextBackColor` or `TXITEM_PageColor`. The reference lists the icons each property affects. `null`, the default, keeps the default color.
- [Culture](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms/resourceprovider-imagesourcesettings/culture-property/llms-full.txt) selects icons that differ by language; [Localization and Resource Kit](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/localization/llms-full.txt) explains which.

The following method creates a small text color icon with a red color rectangle in the resolution of the `TextControl`, for a button of your own:

```csharp
using System.Drawing;
using TXTextControl.Windows.Forms;

private Bitmap CreateTextColorIcon()
{
    ResourceProvider.ImageSourceSettings settings = new ResourceProvider.ImageSourceSettings();
    settings.FillColor = Color.Red;

    // The resolution is taken from textControl1, whose handle must exist
    return ResourceProvider.GetSmallIcon("TXITEM_TextColor", textControl1, settings);
}
```

The `using` directives go at the top of *Form1.cs* and the method into the class. The overloads that take a control throw an exception if the handle of that control has not been created.

Text Control published a Resource Manager tool on GitHub that lists the identifiers and previews the icons with their DPI, culture and colors. The blog article [X17: Using the Windows Forms Resource Provider](https://www.textcontrol.com/blog/2019/06/01/x17-using-the-windows-forms-resource-provider/) introduces it:

![The TX Text Control Resource Manager showing the icons of the RibbonInsertTab, the selected item TXITEM_TableGroup with its preview, key tip and text, and the settings for raster size, DPI, culture, fill color and stroke color.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-winforms/resource-manager-icons.c0b74298.webp)

### Next Steps

- [Custom Tabs and Commands](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/custom-tabs/llms-full.txt): build ribbon items with these icons.
- [Rulers and Status Bar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/rulers-status-bar/llms-full.txt): the colors of the rulers and the status bar.
- [Localization and Resource Kit](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/localization/llms-full.txt): texts and icons in other languages.
- [Built-in Ribbon Tabs](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/ribbon/llms-full.txt): the tabs whose colors you change.

---

## Nearby

- **Previous:** [Built-In Dialog Boxes](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/dialog-boxes/llms-full.txt)
- **Next:** [Localization and Resource Kit](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/localization/llms-full.txt)
