Skip to main content

Set osxs accent/highlight colors using the commandline

Project description

osx-colors ci ./LICENSE

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 (It probably works on others I just haven't tested it!)
  • Python 3.8 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osx-colors-1.1.0.tar.gz (55.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

osx_colors-1.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file osx-colors-1.1.0.tar.gz.

File metadata

  • Download URL: osx-colors-1.1.0.tar.gz
  • Upload date:
  • Size: 55.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for osx-colors-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8ce1f24c39fd6fc3810263dc22842478379adb4e470ecfbaf75edc6c9c4434ef
MD5 b89275e67398e0504a17bf5922feabb1
BLAKE2b-256 8eeb11a8f106845d3e7256a0b498e5322d385463441df28f5cfd6649725896e6

See more details on using hashes here.

File details

Details for the file osx_colors-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: osx_colors-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for osx_colors-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f37a8fb0ccf96678bdeb788f45a7ebbfc57f8257930c9329f1363c043c9f6547
MD5 f4a542094246d86ed5d15b897e6649ed
BLAKE2b-256 079df75a42600d8e1e7abc32548e28b927d0e7b615b45236d9bf04837f890adb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page