> 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/basic-operations/basics/night-mode-ios.md).

# Page color mode

Enhance your PDF viewing experience with PDFViewCtrl's special color modes: night mode, inverted color mode, and custom color mode. Learn how to set and customize these modes for optimal readability.

[`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)

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

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

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

{% endcode %}
{% endtab %}
{% endtabs %}

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:

{% tabs %}
{% tab title="C#" %}
{% 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 %}
{% endtab %}
{% endtabs %}

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

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

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

{% endcode %}
{% endtab %}
{% endtabs %}

![](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)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/xamarin/basic-operations/basics/night-mode-ios.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
