Skip to main content

osx-colors ci

Sane command line color customisation for osx, no more fiddling about with defaults, internal apple color constants and rgb color codes

Say you want to change your Accent and Highlight Color to Green like this

If you wanted to change it via terminal, normally you'd need to do this

$ defaults write -g AppleAccentColor -string 3
$ defaults write -g AppleHighlightColor -string "0.752941 0.964706 0.678431 Green"

Instead.... do this 😄

$ osx-colors set green

Or to set your Accent & Highlight color based on the wallpaper pallete generated from pywal also requires jq

$ osx-colors set $(jq --raw-output '.colors.color9' < ~/.cache/wal/colors.json)

Features

  • Sane color handling using color names and a single command
  • Provide it a color in hex and it'll find the "nearest" available apple color to it and set it to this, this is awesome if you use pywal and want matching accent/highlight colors to your wallpaper
  • Restarts Finder,Docker,System Preferences etc upon setting so colors can be immediately seen

Why

I'm a huge fan of pywal and what I thought would complete the color scheme would be Accent & Highlight colors in osx that were based on the generated color palette of the wallaper, however I wasn't able to find anything that did it and color management from the commandline simply sucked, so I wrote this for my personal needs

Limitations

  • At present you can only set both the AccentColor and HighlightColor together, however the HighlightColor can be customized to any color in the UI (from what I can see)
  • Finding the nearest "color" isn't perfect but i've found it good enough, welcome alternative algorithms/solutions to this

Getting Started

Dependencies

  • MacOS Monterey or greater
  • Python 3.9 or greater

Installing

pip install osx-colors

Usage

To set the Accent and Highlight color to Red

$ osx-colors set red
Setting the 'Accent Color' to 'red'
Setting the 'Highlight Color' to 'red'
Restarting Finder, Spotlight and System Preferences, others may need to be restarted manually

To set the Accent and Highlight color to the closest color to the HEX color provided

$ osx-colors set 0029ff
Searching for the closest Apple color to '0029ff' we found 'blue'
Setting the 'Accent Color' to 'blue'
Setting the 'Highlight Color' to 'blue'
Restarting Finder, Spotlight and System Preferences, others may need to be restarted manually

For more usage instructions see

$ osx-colors --help

Contributing

Feel free to lodge an issue regarding a feature request/bug report and we'll go from there!

All contributions welcome 🙂

Running the tests

$ make test

For other build tasks see Makefile

Versioning

We use SemVer for versioning. For the versions available, see the Releases on this repository.

TODO

  • Ability to get colors - not sure of use case?
  • Ability to set a custom Highlight color

License

This project is licensed under the MIT license

Acknowledgments

  • Thanks to ofstack for the code to match the "nearest" color, i'm no color scientist
  • Thanks to quantum_libet on reddit for a rundown on the insanity of color management via the terminal

Metadata

Release files for osx-colors 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for osx-colors 1.1.1
File Size Uploaded Provenance Actions
osx_colors-1.1.1.tar.gz 53.1 kB Without provenance Details for osx_colors-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for osx-colors 1.1.1
File Interpreter ABI Platform Actions
osx_colors-1.1.1-py3-none-any.whl Python 3 none any Details for osx_colors-1.1.1-py3-none-any.whl

Total release size: 60.9 kB

Release files / osx_colors-1.1.1.tar.gz

Download URL osx_colors-1.1.1.tar.gz
Size 53.1 kB
Tags Source
SHA-256 checksum
How to use checksums
56ce4aad0e4b035cb815ced4e3706155e7988436dd995196dd58e8e7fa031a35
BLAKE2b-256 checksum
How to use checksums
93587996e860527a7f322da9df4c80a4f1c6b5dfd6d3ace9e8c968c61927938d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / osx_colors-1.1.1-py3-none-any.whl

Download URL osx_colors-1.1.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61439a6db1231423aadd962d11582316b5a5d07ba0d8a7dcf0b86d8fd2e1a398
BLAKE2b-256 checksum
How to use checksums
9c71c441cc14b4b7b8adec3bbfcbb9808ee81531a38ea5eb0e1b931f5eef8e1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for osx-colors 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page