{"id":31027083,"url":"https://github.com/willhackett/is-dark","last_synced_at":"2025-09-13T18:51:21.959Z","repository":{"id":57277064,"uuid":"188960735","full_name":"willhackett/is-dark","owner":"willhackett","description":"Detect whether or not the system is in dark mode from the browser.","archived":false,"fork":false,"pushed_at":"2023-12-15T05:25:28.000Z","size":6,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-27T21:19:57.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/willhackett.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}},"created_at":"2019-05-28T05:36:40.000Z","updated_at":"2019-11-15T09:38:56.000Z","dependencies_parsed_at":"2023-12-15T06:43:35.585Z","dependency_job_id":null,"html_url":"https://github.com/willhackett/is-dark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/willhackett/is-dark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willhackett%2Fis-dark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willhackett%2Fis-dark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willhackett%2Fis-dark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willhackett%2Fis-dark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willhackett","download_url":"https://codeload.github.com/willhackett/is-dark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willhackett%2Fis-dark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275013282,"owners_count":25390481,"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","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-09-13T18:51:18.418Z","updated_at":"2025-09-13T18:51:21.949Z","avatar_url":"https://github.com/willhackett.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# is-dark\nDetect whether or not the system is in dark mode from the browser.\n\n![Come to the dark side!](https://i.imgur.com/ShUTLqk.gif)\n\n## Rationale\n\nThe choice of whether to enable a light or dark appearance is an aesthetic one for most users, and might not relate to ambient lighting conditions. Websites should support both appearances and react to changes at the system level.\n\n## Installation\n\nInstall the package using `npm` or `yarn`\n\n```bash\nnpm install -S is-dark\n```\n\n```bash\nyarn add is-dark\n```\n\n## Usage\n\n### Check Once\n\nTo check once, simply call the default export from `is-darkmode`.\n\n```typescript\nimport isDarkMode from 'is-darkmode'\n\nisDarkMode() // true | false\n```\n\n### Subscribe to System Changes\n\nTo subscribe to system UI changes, call the `onChange` method.\n\n```typescript\nimport { subscribeToColorScheme } from 'is-darkmode'\n\nlet textColor = 'black'\nlet bgColor = 'white'\n\nsubscribeToColorScheme((scheme) =\u003e {\n  switch(scheme) {\n    case 'dark':\n      textColor = 'white'\n      bgColor = 'black'\n      break;\n    case 'light':\n      textColor = 'black'\n      bgColor = 'white'\n      break;\n  }\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillhackett%2Fis-dark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillhackett%2Fis-dark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillhackett%2Fis-dark/lists"}