> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/xamarin/viewer/themes.md).

# Customize PDFViewCtrl

Customize color themes in Xamarin.Android and Xamarin.iOS viewers with day, night, and custom color modes. Learn how to set viewer themes and color modes for optimal viewing experience. The Apryse Xam

You can change the color themes inside document viewers.

{% tabs %}
{% tab title="Android" %}

## Viewer theme customization in Xamarin.Android

[Day and night themes](/xamarin/guides/android/viewer/themes.md#night) Find out more about the sleek day and night themes available for the viewer UI.

[Page Color mode](/xamarin/guides/android/viewer/themes.md#custom) Pages can be viewed in various color modes, find out more here.
{% endtab %}

{% tab title="iOS" %}

## Change color theme in Xamarin.iOS viewer

[`PDFViewCtrl`](https://sdk.apryse.com/api/xamarinios/tools/api/pdftron.PDF.PDFViewCtrl.html) has three special color modes: night mode, inverted color mode, and custom color mode. In night mode, colors are adjusted to improve reading at night, in inverted color mode, all colors are inverted, and in custom color mode, you can set a custom color for text and the background color.

![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-343375628c2dff8eebaa3c1a94bea5d0a9ff71ae%2F66f05a343d0341455b509a9282075128a28bd48a-1430x544.png?alt=media)

Color modes from left to right: normal color mode, inverted color mode, night mode and custom color mode.

## Set the color mode

To set the color mode:

1. Find the constant value of the color mode

| Color mode          | Constant value                                                                                                                                                          |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Normal color mode   | [`PDFRasterizer.ColorPostProcessMode.e_postprocess_none`](https://sdk.apryse.com/api/xamarinios/pdfnet/api/pdftron.PDF.PDFRasterizer.ColorPostProcessMode.html)         |
| Night mode          | [`PDFRasterizer.ColorPostProcessMode.e_postprocess_night_mode`](https://sdk.apryse.com/api/xamarinios/pdfnet/api/pdftron.PDF.PDFRasterizer.ColorPostProcessMode.html)   |
| Inverted color mode | [`PDFRasterizer.ColorPostProcessMode.e_postprocess_invert`](https://sdk.apryse.com/api/xamarinios/pdfnet/api/pdftron.PDF.PDFRasterizer.ColorPostProcessMode.html)       |
| Custom color mode   | [`PDFRasterizer.ColorPostProcessMode.e_postprocess_gradient_map`](https://sdk.apryse.com/api/xamarinios/pdfnet/api/pdftron.PDF.PDFRasterizer.ColorPostProcessMode.html) |

1. Call `SetColorPostProcessMode`.
2. Optionally, set the `PDFViewCtrl` background color for the best visual result. You can set background color by calling `SetClientBackgroundColor` (Xamarin.Android) or `SetBackgroundColor` (Xamarin.iOS).For example, set the background color to black for night mode:

![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-e2fd299ceaf0f87ad2aecf8f82269abbfed10f62%2F11a67ce052a7a6199ddd8c12ea5f1144a758c901-392x292.png?alt=media)

{% code lineNumbers="true" %}

```csharp
// Xamarin.Android
mPdfViewCtrl.SetClientBackgroundColor(0, 0, 0, false);

// Xamarin.iOS
mPdfViewCtrl.SetBackgroundColor(0, 0, 0, false);
```

{% endcode %}

1. If you are using `postprocess_gradient_map`, call `PDFViewCtrl.SetColorPostProcessColors` to set the white and black points. For example, for a sepia effect, try:

{% code lineNumbers="true" %}

```csharp
// Xamarin.Android
var darkBrown = Android.Graphics.Color.Rgb(61, 38, 10);
var lightBrown = Android.Graphics.Color.Rgb(245, 224, 202);
mPdfViewCtrl.SetColorPostProcessColors(lightBrown, darkBrown);

// Xamarin.iOS
var darkBrown = new UIKit.UIColor(0.24f, 0.15f, 0.04f, 1.0f);
var lightBrown = new UIKit.UIColor(0.96f, 0.88f, 0.79f, 1.0f);
mPdfViewCtrl.SetColorPostProcessColors(lightBrown, darkBrown);
```

{% endcode %}

1. Update `PDFViewCtrl` to redraw the contents:Sample result when using `postprocess_gradient_map` and a light/dark brown for the white/black color:

{% code lineNumbers="true" %}

```csharp
mPdfViewCtrl.Update(true);
```

{% endcode %}

![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-147581910216d35f3a25250590fcd193fc50dc02%2F763253aeabe683dda72a42172754b12942b3ec44-948x1228.png?alt=media)
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/xamarin/viewer/themes.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
