{"id":6084,"library":"pyobjc-framework-colorsync","title":"PyObjC Framework ColorSync","description":"pyobjc-framework-colorsync provides Python wrappers for Apple's ColorSync framework on macOS. It allows Python applications to interact with macOS's color management system, including accessing color profiles and performing color conversions. As part of the larger PyObjC project, it closely follows macOS SDK updates and typically releases alongside new macOS versions and major Python releases, maintaining compatibility with the latest macOS features.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","cocoa","colorsync","framework","color management"],"install":[{"cmd":"pip install pyobjc-framework-colorsync","lang":"bash","label":"Install `pyobjc-framework-colorsync`"}],"dependencies":[{"reason":"This package wraps a macOS framework and requires the core PyObjC bridge for Objective-C runtime interaction.","package":"pyobjc-core","optional":false}],"imports":[{"note":"PyObjC frameworks are imported directly by their framework name (e.g., `ColorSync`), not from the PyPI package name.","wrong":"from pyobjc_framework_colorsync import ColorSync","symbol":"ColorSync","correct":"import ColorSync"}],"quickstart":{"code":"import ColorSync\nimport objc # Recommended for general PyObjC interaction as it sets up the bridge\n\n# ColorSync interactions often involve C functions or Core Foundation types.\n# Get the default profile ID for the primary display.\n# The domain argument expects a byte string (e.g., b\"display\", b\"output\").\n# The function returns a CFStringRef, which PyObjC automatically bridges to a Python string.\ntry:\n    display_profile_id = ColorSync.ColorSyncGetDefaultProfileID(b\"display\")\n    print(f\"Successfully retrieved default display profile ID: {display_profile_id}\")\nexcept AttributeError:\n    print(\"Error: ColorSyncGetDefaultProfileID not found. Ensure the ColorSync framework is available and PyObjC is correctly installed on macOS.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred while accessing ColorSync: {e}\")\n\n# This quickstart demonstrates importing the framework and calling a basic C-level function,\n# which is a common pattern for interacting with some parts of PyObjC-wrapped frameworks.","lang":"python","description":"This example demonstrates how to import the ColorSync framework and use a common C-level function, `ColorSyncGetDefaultProfileID`, to retrieve the default color profile identifier for the primary display. This illustrates basic interaction with the framework's C APIs."},"warnings":[{"fix":"Upgrade to a supported Python version (e.g., 3.10+ for PyObjC 12.x) before upgrading `pyobjc-framework-colorsync` to avoid installation or runtime errors.","message":"PyObjC frequently drops support for older Python versions. Version 12.0 dropped Python 3.9, and version 11.0 dropped Python 3.8. Always check the `requires_python` metadata for compatibility.","severity":"breaking","affected_versions":">=11.0"},{"fix":"Code that manually managed reference counts or made specific assumptions about initializer behavior at a low level (e.g., directly with `CFTypeRef` or `objc.object` instances) might need review. Most Python-level usage should remain unaffected.","message":"The behavior of Objective-C initializer methods (methods in the 'init' family) was changed in PyObjC v11.1 to align with `clang`'s automatic reference counting (ARC) documentation. These methods now correctly 'steal' a reference to `self` and return a new one.","severity":"breaking","affected_versions":">=11.1"},{"fix":"If implementing `__new__`, ensure `__init__` is correctly invoked on the returned object if your class hierarchy supports it. For classes where PyObjC provides `__new__`, shift initialization logic to `__new__` or use alternative setup methods.","message":"When implementing `__new__` in Python subclasses of Objective-C classes, the ability to call `__init__` on the created object was temporarily broken in v10.3 and partially restored in v10.3.1. However, code relying on the PyObjC-provided `__new__` still cannot use `__init__` for custom initialization.","severity":"gotcha","affected_versions":"10.3, 10.3.1"},{"fix":"Consult Apple's developer documentation for framework deprecations and target appropriate APIs. When migrating to a newer macOS and PyObjC version, be prepared to refactor code relying on removed frameworks.","message":"Specific macOS frameworks or APIs may be deprecated or entirely removed in newer macOS versions. PyObjC bindings will also cease to be available or function for these removed frameworks. For example, 'IMServicePlugIn' bindings were removed in PyObjC 10.0 due to the framework's removal in macOS 14.","severity":"breaking","affected_versions":">=10.0"},{"fix":"Exercise caution when using PyObjC with free-threading enabled in Python 3.13+. Thoroughly test existing multi-threaded code and report any issues to the PyObjC project to aid in stabilization.","message":"PyObjC 11 introduced experimental support for PEP 703 (free-threading) in Python 3.13, which required significant internal changes. While the library aims for compatibility, complex multi-threaded Objective-C interactions might behave unexpectedly.","severity":"gotcha","affected_versions":">=11.0 (with Python 3.13+)"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}