Skip to content

A command-line utility for setting ColorSync profiles for connected displays on OS X.

License

Notifications You must be signed in to change notification settings

agentirons/customdisplayprofiles

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

customdisplayprofiles

This is a simple command-line Python script that can check, set or unset a custom ColorSync ICC profile for a given display. It uses PyObjC and the most current (as of 2013) ColorSync API to do this.

Usage

Installing Python dependencies

This script requires the 'pyobjc' package available through pip, e.g.:

pip3 install pyobjc

NOTE: This script calls for import Foundation and import Quartz, but these are not the modules installed through pip install Foundation or pip install Quartz.

Setting a profile

Use the set action to set a profile (as the user running the command) for the main display.

customdisplayprofiles set /path/to/profile.icc

Use the --display option to configure an alternate display.

customdisplayprofiles set --display 2 /path/to/profile.icc

If you want to get a list of displays with their associated index:

customdisplayprofiles displays

Configurable user scope

The --user-scope option allows you to define whether the profile will be applied to the "Current" or "Any" user domain, which may allow you set this preference as a default for all users:

customdisplayprofiles set --user-scope any /path/to/profile.icc

Specifying any here requires root privileges, as it will write these preferences to a system-owned location.

More information on the user preferences system on OS X can be found here and here.

Retrieving the current profile

The full path to an ICC profile can be printed to stdout:

customdisplayprofiles current-path

This could be useful if you want to check the current setting using an idempotent login script or a configuration framework like Puppet.

current-path will output nothing if there is no profile currently set for that display.

Full details

A more complete dictionary of information can be printed with the info action:

➜ ./customdisplayprofiles info
{
    CustomProfiles =     {
        1 = "file://localhost/Library/Application%20Support/Adobe/Color/Profiles/SMPTE-C.icc";
    };
    DeviceClass = mntr;
    DeviceDescription = iMac;
    DeviceHostScope = kCFPreferencesCurrentHost;
    DeviceID = " 00000610-0000-B005-0000-0000042C0140";
    DeviceUserScope = kCFPreferencesAnyUser;
    FactoryProfiles =     {
        1 =         {
            DeviceModeDescription = iMac;
            DeviceProfileURL = "file://localhost/Library/ColorSync/Profiles/Displays/iMac-00000610-0000-B005-0000-0000042C0140.icc";
        };
        DeviceDefaultProfileID = 1;
    };
}

Sample wrapper script

There's a (very simple) example script in the sample-helper-login-script folder, which demonstrates how you could wrap this utility in an environment where you don't manage the ICC profiles directly. Someone calibrating a display would only need to drop the profile in a known folder location, indexed by display number, and at login for all users, the desired color profiles are configured for each online display.

Building a pkg

You might want to build a pkg to deploy the script to one or more Macs in your environment. To create a pkg so, you can run the make command in the repo folder. The included Makefile will be used to create a package which will install customdisplayprofiles in /usr/local/bin If you'd like to install the script at a different path, you can override the default when creating the package with
make INSTALLPATH=/path/to/installfolder

If you're also using munki, there's a make munki command to import the package into your munki repository.

# first run make to create the pkg
make

# Then, import the package into munki
make MUNKI_REPO_SUBDIR=util munki

About

A command-line utility for setting ColorSync profiles for connected displays on OS X.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 80.6%
  • Shell 12.1%
  • Makefile 7.3%