> 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/ios/viewer/night-mode.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 color modes for optimal reading. The

[`PDFViewCtrl`](https://sdk.apryse.com/api/ios/Classes/PTPDFViewCtrl.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://4149080208-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgY6xtY9ZQd9XMpvWlGM0%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   | [`e_ptpostprocess_none`](https://sdk.apryse.com/api/ios/Enums/PTColorPostProcessMode.html#/c:@E@PTColorPostProcessMode@e_ptpostprocess_none)                 |
| Night mode          | [`e_ptpostprocess_night_mode`](https://sdk.apryse.com/api/ios/Enums/PTColorPostProcessMode.html#/c:@E@PTColorPostProcessMode@e_ptpostprocess_night_mode)     |
| Inverted color mode | [`e_ptpostprocess_invert`](https://sdk.apryse.com/api/ios/Enums/PTColorPostProcessMode.html#/c:@E@PTColorPostProcessMode@e_ptpostprocess_invert)             |
| Custom color mode   | [`e_ptpostprocess_gradient_map`](https://sdk.apryse.com/api/ios/Enums/PTColorPostProcessMode.html#/c:@E@PTColorPostProcessMode@e_ptpostprocess_gradient_map) |

1. Call [`setColorPostProcessMode(_ mode: PTColorPostProcessMode)`](https://sdk.apryse.com/api/ios/Classes/PTPDFViewCtrl.html#/c:objc\(cs\)PTPDFViewCtrl\(im\)SetColorPostProcessMode:).
2. Optionally, set the `PDFViewCtrl` background color for the best visual result. You can set background color by calling [`setBackgroundColor(_ r: UInt8, g: UInt8, b: UInt8, a: UInt8)`](https://sdk.apryse.com/api/ios/Classes/PTPDFViewCtrl.html#/c:objc\(cs\)PTPDFViewCtrl\(im\)SetBackgroundColor:g:b:a:).For example, set the background color to black for night mode:

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

{% tabs %}
{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
pdfViewCtrl.setBackgroundColor(0, g: 0, b: 0, a: 255)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
[self.pdfViewCtrl SetBackgroundColor:0 g:0 b:0 a:255];
```

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

1. If you are using `postprocess_gradient_map`, call [`setColorPostProcessColors(_ white_color: UIColor!, black_color: UIColor!)`](https://sdk.apryse.com/api/ios/Classes/PTPDFViewCtrl.html#/c:objc\(cs\)PTPDFViewCtrl\(im\)SetColorPostProcessColors:black_color:) to set the white and black points. For example, for a sepia effect, try:

{% tabs %}
{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
let darkBrown = UIColor(red:0.24, green:0.15, blue:0.04, alpha:1.0)
let lightBrown = UIColor(red:0.96, green:0.88, blue:0.79, alpha:1.0)
pdfViewCtrl.setColorPostProcessColors(lightBrown, black_color: darkBrown)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
UIColor* darkBrown = [UIColor colorWithRed:0.24 green:0.15 blue:0.04 alpha:1.0];
UIColor* lightBrown = [UIColor colorWithRed:0.96 green:0.88 blue:0.79 alpha:1.0];
[self.pdfViewCtrl SetColorPostProcessColors:lightBrown black_color: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="Swift" %}
{% code lineNumbers="true" %}

```swift
pdfViewCtrl.update(true)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
[self.pdfViewCtrl Update:YES];
```

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

![](https://4149080208-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgY6xtY9ZQd9XMpvWlGM0%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 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/ios/viewer/night-mode.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.
