{"id":16889603,"url":"https://github.com/antoineprv/dark-mode","last_synced_at":"2026-01-07T13:48:43.840Z","repository":{"id":68453279,"uuid":"417895353","full_name":"AntoinePrv/dark-mode","owner":"AntoinePrv","description":"MacOS script to interact with dark mode","archived":false,"fork":false,"pushed_at":"2024-05-29T16:01:23.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-03T20:11:11.235Z","etag":null,"topics":["dark-mode","macos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AntoinePrv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-16T17:13:14.000Z","updated_at":"2024-10-04T22:02:05.000Z","dependencies_parsed_at":"2024-05-29T18:54:09.572Z","dependency_job_id":null,"html_url":"https://github.com/AntoinePrv/dark-mode","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntoinePrv%2Fdark-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntoinePrv%2Fdark-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntoinePrv%2Fdark-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntoinePrv%2Fdark-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AntoinePrv","download_url":"https://codeload.github.com/AntoinePrv/dark-mode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246150437,"owners_count":20731419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dark-mode","macos"],"created_at":"2024-10-13T16:57:54.917Z","updated_at":"2026-01-07T13:48:43.797Z","avatar_url":"https://github.com/AntoinePrv.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dark Mode\nMacOS and Linux scripts to interact with dark mode.\n\n## Features\n - Get current mode\n - Change active mode\n - Listen for theme events and run a shell script on change\n - Listen for theme events and change between\n   [chriskempson/base16-shell](https://github.com/chriskempson/base16-shell) themes\n\n## Installation\n### MacOS\n#### Manual\nEither run it directly with\n```sh\n./macos/dark-mode.swift \u003ccommand\u003e\n```\nOr compile it with\n```sh\nswiftc -o dark-mode ./macos/dark-mode.swift\n```\n\n#### With [Zinit](https://github.com/zdharma/zinit)\n```zsh\nzinit ice lucid from='gh' if='[[ \"$(uname -s)\" == Darwin* ]]' \\\n\tatclone='swiftc -o dark-mode macos/dark-mode.swift' atpull=\"%atclone\" sbin='dark-mode'\nzinit light @AntoinePrv/dark-mode\n```\n\n### Linux (Gnome)\n#### Manual\nThe script is a standalone bash wrapper around `gsettings`.\n```sh\n./linux/gnome/dark-mode.sh\n```\n\n#### With [Zinit](https://github.com/zdharma/zinit)\n```zsh\nzinit ice lucid from='gh' if='[[ \"$(uname -s)\" == Linux* ]]' \\\n\tsbin='linux/gnome/dark-mode.sh -\u003e dark-mode'\nzinit light @AntoinePrv/dark-mode\n```\n\n## Usage\n```help\nUsage:\ndark-mode (help | --help | -h)\nPrint this message and exit.\n\ndark-mode get\nPrint the current mode, either \"dark\" or \"light\".\n\ndark-mode dark\nSet theme to dark.\n\ndark-mode light\nSet theme to light\n\ndark-mode toogle\nToogle the theme to the opposite one.\n\ndark-mode listen \u003cscript\u003e [\u003cargs\u003e...]\nListen for theme changes and run the given script.\nThe new theme, either \"dark\" or \"light\" is passed as the last argument to the script.\n\ndark-mode base16 --root \u003cbase16-root\u003e --light \u003clight-theme\u003e --dark \u003cdark-theme\u003e\nListen for theme changes and change to the base16 theme accordingly\n```\n\n## Example using listen to change terminal theme\nUsing [chriskempson/base16-shell](https://github.com/chriskempson/base16-shell) to change the\nterminal theme, one can use something like\n```sh\ndark-mode base16 --root \"${HOME}/.local/share/base16\" --light \"ia-light\" --dark \"ia-dark\"\n```\nTo run the `dark-mode` listener in the background, for instance starting it in `.bashrc`/`.zshrc`,\nyou can use\n```bash\n# Only run if using MacOS.\nif [[ \"$OSTYPE\" == \"darwin\"* ]]; then\n    # Don't run withing Tmux or SSH, as it will already be running in the first terminal session.\n    if [[\"${TERM}\" != \"screen\"* \u0026\u0026  ! -n \"${TMUX}\" ]] \u0026\u0026 ! [[ -n \"${SSH_CLIENT}\" || -n \"${SSH_TTY}\" ]]; then\n        (\n            # Run dark-mode in the background, removing it from the job list.\n            dark-mode base16 --root \"${XDG_DATA_HOME}/base16\" --light \"one-light\" --dark \"onedark\" \u0026\n            # Kill dark-mode when the shell exits.\n            bash -c \"while ps -p $$ 2\u003e\u00261 1\u003e/dev/null; do sleep 60; done; pkill -P $!\" \u0026\n        )\n    fi\nfi\n\n```\n\n## Credit\nHeavily inspired by:\n - [sindresorhus/dark-mode](https://github.com/sindresorhus/dark-mode) for changing the active mode\n - [bouk/dark-mode-notify](https://github.com/bouk/dark-mode-notify) for listening to events\n - [Fatih Arslan](https://arslan.io/2021/02/15/automatic-dark-mode-for-terminal-applications/) for inspiration\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoineprv%2Fdark-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoineprv%2Fdark-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoineprv%2Fdark-mode/lists"}