A tiny macOS command-line tool to enable, disable, or toggle system-wide grayscale mode.
cargo install --path .
git clone https://github.com/eugenehp/grayscale.git
cd grayscale
cargo build --release
cp target/release/grayscale /usr/local/bin/
grayscale on # enable grayscale
grayscale off # disable grayscale
grayscale toggle # toggle the current state
grayscale status # print "on" or "off" to stdout
status prints to stdout so it can be used in scripts:
if [ "$(grayscale status)" = "on" ]; then
echo "display is grayscale"
fiThe tool calls UAGrayscaleSetEnabled and UAGrayscaleIsEnabled from Apple's private UniversalAccess.framework, loaded at runtime via dlopen. No Objective-C runtime or extra dependencies are needed.
- macOS (compile-time enforced)
- The UniversalAccess private framework (ships with macOS)
grayscale also exposes a library crate:
grayscale::enable();
grayscale::disable();
let on = grayscale::is_enabled();
let new_state = grayscale::toggle();MIT