# grayscale
A tiny macOS command-line tool to enable, disable, or toggle system-wide grayscale mode.
## Installation
### From source
```
cargo install --path .
```
### Build manually
```
git clone https://github.com/eugenehp/grayscale.git
cd grayscale
cargo build --release
cp target/release/grayscale /usr/local/bin/
```
## Usage
```
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:
```sh
if [ "$(grayscale status)" = "on" ]; then
echo "display is grayscale"
fi
```
## How it works
The 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.
## Requirements
- macOS (compile-time enforced)
- The UniversalAccess private framework (ships with macOS)
## Library usage
`grayscale` also exposes a library crate:
```rust
grayscale::enable();
grayscale::disable();
let on = grayscale::is_enabled();
let new_state = grayscale::toggle();
```
## License
MIT