Skip to content

Set NSWindow color space to sRGB on macOS#10827

Merged
SoftFever merged 1 commit into
OrcaSlicer:mainfrom
as-com:mac-srgb
Sep 28, 2025
Merged

Set NSWindow color space to sRGB on macOS#10827
SoftFever merged 1 commit into
OrcaSlicer:mainfrom
as-com:mac-srgb

Conversation

@as-com

@as-com as-com commented Sep 21, 2025

Copy link
Copy Markdown
Contributor

Description

This PR addresses an issue where colors in the 3D view are over-saturated on displays with a wide color gamut and also fixes flickering colors after the window is dragged between displays with different color profiles.

Note: this change does not affect Windows or Linux.

Screenshots/Recordings/Graphs

Left is with this change, right is original

Screenshot 2025-09-21 at 12 29 36 PM

If you do not have a display that supports a wide color gamut or your system's color management is not properly configured, you may find it difficult to see the difference in this screenshot. (Try viewing it on a recent smartphone)

Tests

Tested on macOS

@SoftFever

Copy link
Copy Markdown
Collaborator

Hi, thank you for your pull request.
I do have some concerns, though. I don't think we should hard-code the color space in the application. This kind of setting should be managed at the OS level, allowing users to configure it there.

@as-com

as-com commented Sep 23, 2025

Copy link
Copy Markdown
Contributor Author

This kind of setting should be managed at the OS level, allowing users to configure it there.

I’m not sure I understand. This is something that the application is responsible for configuring and can’t be overridden at the OS level. It should be set to the color space the application is rendering in, which in this case is sRGB, so that the OS can apply the display’s color profile and show the correct colors on the screen.

@SoftFever

Copy link
Copy Markdown
Collaborator

This kind of setting should be managed at the OS level, allowing users to configure it there.

I’m not sure I understand. This is something that the application is responsible for configuring and can’t be overridden at the OS level. It should be set to the color space the application is rendering in, which in this case is sRGB, so that the OS can apply the display’s color profile and show the correct colors on the screen.

I must admit, I don't have enough knowledge on this topic. The application was using native RGB. as you can see, our rendering target uses the BGRA(which is bassically RGBA channel, 8 bit per channel) color format. I assumed the operating system's color profile would automatically map to the corresponding color space. From what I understand, the RGB differs from the sRGB color profile—the ranges are different.

I did a quick Google search and found some discussions in the GLFW repo, but it seems those are quite recent, haven't been merged yet, and there isn't much discussion.

After evaluating this, I'm open to trying this change. Since I only use a Mac native monitor, I can't really tell the difference.

@SoftFever SoftFever merged commit 32ca697 into OrcaSlicer:main Sep 28, 2025
11 checks passed
@SoftFever

SoftFever commented Sep 28, 2025

Copy link
Copy Markdown
Collaborator

Hi @as-com
I think the default MacBook Pro screen looks a bit off. It appears somewhat dull now.
I will revert the change for now.
Screenshot 2025-09-28 at 2 15 57 PM

SoftFever added a commit that referenced this pull request Sep 28, 2025
SoftFever added a commit that referenced this pull request Sep 28, 2025
Revert "Set NSWindow color space to sRGB on macOS (#10827)"

This reverts commit 32ca697.
@as-com

as-com commented Sep 28, 2025

Copy link
Copy Markdown
Contributor Author

@SoftFever MacBook Pros since 2016 have shipped with wide color gamut (Display P3) displays, so the version with color management disabled will look much more saturated. The "duller" version (i.e. the one with color management enabled) is actually the more accurate rendition and will appear consistent across different displays. You can see the effect (and possibly reproduce the flickering colors) by connecting an (older? cheaper?) external monitor without wide color and dragging the OrcaSlicer window between it and the internal display. I triggered the flickering bug by dragging OrcaSlicer between the internal display (Display P3) and a Dell U2415 (sRGB).

Incorrect color management also has effects other than searing your retinas - on displays with very deep color primaries like the red primary on LG Nano IPS and some recent OLED displays, red (#ff0000 in the display's native color space) text can have poor contrast with dark grey backgrounds unless it's properly converted from the actual intended color (such as #ff0000 in sRGB) to the display's color space.

Copy link
Copy Markdown
Collaborator

Hi, Andrew
Here for the detailed explanation. Let me give it another try.

SoftFever added a commit that referenced this pull request Jan 6, 2026
# Description

Fixes #6813 
Fixes #7782 
Fixes #6367

This is a port of libvgcode, OpenGL Core Profile (libvgcode requires OpenGL 3.2+), and probably other stuff I forgot from PrusaSlicer. libvgcode is also known as "Improved G-code Viewer" which was introduced in [PrusaSlicer 2.8.0](https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.8.0-alpha5). It significantly improves performance of the G-code preview and allows displaying the actual speed and volumetric flow rate.

## TODO

- [x] Make the sliders work properly again
- [x] Make view type selection work
- [x] Fix toggling of feature type visibility
- [x] Expose actual speed/actual flow view types
- [x] Fix display of G2/G3 arcs
- [x] Wire up actual speed graph widgets
- [x] Fix painter gizmos
- [x] Fix crash when selecting filament view type on Windows
- [ ] Figure out display color management (#10827)
- [x] Fix incorrect rendering of small area flow compensation (or any extrusions with varying flow)
- [ ] Localization
- [ ] Testing
- [ ] Code cleanup, performance optimization

## Removed functionality

Some functionality is not supported by libvgcode:

- Toggling visibility of tools
- Toggling visibility of colors in color print view
- Support for systems with OpenGL <3.2
- Bambu's implementation of G2/G3 arcs was replaced with PrusaSlicer's implementation

# Screenshots/Recordings/Graphs

https://github.com/user-attachments/assets/c1413a82-3058-4541-b96c-3d5f7cdef174

<details>
<summary>Outdated Stuff</summary>

https://github.com/user-attachments/assets/ca172ef4-0828-4d21-8768-b08a4132c9ab

<img width="1611" height="1145" alt="image" src="https://github.com/user-attachments/assets/5e0d04ff-8046-4636-a08a-cdedc60303bc" />
</details>

## Tests

- [x] Normally sliced G-code
- [ ] G-code viewer mode
- [x] Arc fitting enabled
- [x] Spiral Z-hops
- [x] Multi-extruder/multi-color
- [x] Vase mode
- [x] Skirt/brim
- [x] Supports
- [ ] Support transition (whatever this is)
- [x] Painter gizmos
- [x] Measurement gizmo
- [x] Move/rotate/scale gizmos
- [x] H2D/H2S support (oh no)
- [ ] Windows
- [x] macOS
- [ ] Linux
SoftFever pushed a commit that referenced this pull request Mar 2, 2026
SoftFever pushed a commit that referenced this pull request Mar 3, 2026
Xipit pushed a commit to Xipit/OrcaSlicer that referenced this pull request Mar 16, 2026
davidjdixon pushed a commit to davidjdixon/OrcaSlicer that referenced this pull request Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants