Skip to content

Instantly share code, notes, and snippets.

@IAmAdamTaylor
Last active November 26, 2019 10:10
Show Gist options
  • Save IAmAdamTaylor/925750ff0935cad05983f88c2b5b8510 to your computer and use it in GitHub Desktop.
Save IAmAdamTaylor/925750ff0935cad05983f88c2b5b8510 to your computer and use it in GitHub Desktop.
App Specific Dark/Light Mode in Mac OS X (Tested on 10.15.1 Catalina)
lightMode() {
if [[ "$#" != 2 ]]; then
echo "Must pass exactly 2 arguments."
echo "Usage: lightMode <App_Name> <Yes|No>"
return 2
fi
if [[ "$2" != "Yes" && "$2" != "No" ]]; then
echo "2nd argument must be Yes or No."
echo "Usage: lightMode <App_Name> <Yes|No>"
return 2
fi
bid=( $(osascript -e 'id of app "'"$1"'"') )
defaults write $bid NSRequiresAquaSystemAppearance -bool $2
}
@IAmAdamTaylor
Copy link
Author

IAmAdamTaylor commented Nov 26, 2019

To use:

  1. Open System Preferences > General and set your system appearance to Dark mode.
  2. Open your ~/.bash_profile file
  3. Add the code from the Gist
  4. Save the file
  5. Open Terminal. If Terminal was already open, you can quit and reopen it, or run $ source ~/.bash_profile to force it to pick up the new changes
  6. In Terminal you can now run commands like $ lightMode Notes No or $ lightMode Chrome Yes. For apps with a space in their name you must escape the space, like $ lightMode System\ Preferences Yes
  7. Once you have run the Terminal command, you will need to quit and reopen the chosen app to see the new mode

To switch an app back to normal dark mode change the 'Yes' to 'No' when entering the command, like $ lightMode System\ Preferences No

N.B.
This can probably be used with a Light system appearance to show specific apps in Dark mode, but I haven't looked into this. If you'd like me to, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment