Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Standalone tool using private Apple framework to toggle display grayscale mode
#include <stdio.h>
// Compile with cc -o gray gray.c -framework UniversalAccess -F /System/Library/PrivateFrameworks
extern void UAGrayscaleSetEnabled(int isEnabled);
extern int UAGrayscaleIsEnabled();
int main() {

This comment has been minimized.

Copy link

@Jean-Daniel Jean-Daniel commented Apr 10, 2019

Want to avoid private framework ? You can do this using private API from public framework (I'm using it since 10.3 at least):

#include <CoreGraphics/CoreGraphics.h>

extern Boolean CGDisplayUsesForceToGray(void);
extern void CGDisplayForceToGray(Boolean gray);

int main() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment