---
title: "Update Text Color"
canonical: https://www.graphicsmill.com/samples/PSDFormat/RenderTemplates/UpdateTextColor_cs
product: "Graphics Mill"
source: "PSDFormat/RenderTemplates/UpdateTextColor.cs"
---

# Update Text Color

Updates text color of PSD image and saves to PDF file.

## Instruction

Write a C# program that updates text color in "BusinessCard.psd" using PSD processor's TextCallback to process text frames via processor.ProcessText, conditionally apply Red SolidBrush to text frame named "Name" while preserving original content via textString parameter for other layers, and render the modified PSD with color-updated text to PDF "UpdateTextColor.pdf".

## Usings

```csharp
using Aurigma.GraphicsMill.Drawing;
using Aurigma.GraphicsMill.Templates;
```

## Code Snippet

```csharp
var psdProcessor = new PsdProcessor();

var psName = psdProcessor.FontResolver.FontRegistry.Add("ARIALUNI.TTF")[0].PostscriptName;
psdProcessor.FontResolver.FontRegistry.FallbackFonts.Add(psName);

psdProcessor.TextCallback = (processor, textFrame, textString) =>
{
    var text = processor.ProcessText(textFrame);
    text.String = textString;

    if (textFrame.Name == "Name")
    {
        text.Brush = new SolidBrush(RgbColor.Red);
    }

    return text;
};

psdProcessor.Render("BusinessCard.psd", "UpdateTextColor.pdf");
```

## Explanation

Below is a C# code sample that selectively updates PSD text layer colors:

The code demonstrates targeted text color modification using TextCallback to intercept text rendering, preserving original content through textString parameter while applying conditional color changes (Red SolidBrush for "Name" layer) via layer name identification. processor.ProcessText maintains original typography, positioning, and effects while allowing Brush customization for specific layers, enabling template-based color variations where only designated text elements change color, supporting brand consistency, personalization, and automated design workflows with preserved typographic fidelity and PDF output.

## Tags

- [Personalization](<https://www.graphicsmill.com/samples/tags/personalization_md>): Replacing placeholders with dynamic content
- [PSD Processor](<https://www.graphicsmill.com/samples/tags/psd-processor_md>): Automating PSD-based personalization

## Input

- [BusinessCard.psd](<https://www.graphicsmill.com/samples/PSDFormat/compiled/Debug/BusinessCard_psd>) (download)

## Output

- [UpdateTextColor.pdf](<https://www.graphicsmill.com/samples/PSDFormat/compiled/Debug/UpdateTextColor_pdf>) (download)
- [UpdateTextColor.png](<https://www.graphicsmill.com/samples/PSDFormat/compiled/Debug/UpdateTextColor_png>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Codecs.Psd.PsdFrame.Name](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_Psd_PsdFrame_Name.htm.md>)
- [Aurigma.GraphicsMill.Drawing.CustomFontRegistry.Add(String)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_CustomFontRegistry_Add_1_bb3a7a4f.htm.md>)
- [Aurigma.GraphicsMill.Drawing.FontAddResult.PostscriptName](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_FontAddResult_PostscriptName.htm.md>)
- [Aurigma.GraphicsMill.Drawing.FontRegistry.FallbackFonts](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_FontRegistry_FallbackFonts.htm.md>)
- [Aurigma.GraphicsMill.Drawing.SolidBrush](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_SolidBrush.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.Brush](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_Brush.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.String](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_String.htm.md>)
- [Aurigma.GraphicsMill.Templates.FontResolver.FontRegistry](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Templates_FontResolver_FontRegistry.htm.md>)
- [Aurigma.GraphicsMill.Templates.PsdProcessor](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Templates_PsdProcessor.htm.md>)
