{"id":13601850,"url":"https://github.com/wechatjs/mp-darkmode","last_synced_at":"2025-04-11T04:31:50.097Z","repository":{"id":42126573,"uuid":"249944405","full_name":"wechatjs/mp-darkmode","owner":"wechatjs","description":"微信公众平台图文 Dark Mode 转换算法","archived":false,"fork":false,"pushed_at":"2024-10-21T07:16:51.000Z","size":972,"stargazers_count":64,"open_issues_count":5,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-23T03:15:56.483Z","etag":null,"topics":["darkmode","wechat-official-account"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/wechatjs.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}},"created_at":"2020-03-25T10:06:43.000Z","updated_at":"2024-10-21T07:05:03.000Z","dependencies_parsed_at":"2024-01-14T04:58:07.147Z","dependency_job_id":"e8b19955-e7fa-42f2-9053-c77e5fda146e","html_url":"https://github.com/wechatjs/mp-darkmode","commit_stats":{"total_commits":17,"total_committers":3,"mean_commits":5.666666666666667,"dds":0.3529411764705882,"last_synced_commit":"d2ff3fdd4fee94b72e14be7a7f3a08c5e646450c"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechatjs%2Fmp-darkmode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechatjs%2Fmp-darkmode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechatjs%2Fmp-darkmode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechatjs%2Fmp-darkmode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wechatjs","download_url":"https://codeload.github.com/wechatjs/mp-darkmode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223458664,"owners_count":17148496,"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":["darkmode","wechat-official-account"],"created_at":"2024-08-01T18:01:08.842Z","updated_at":"2025-04-11T04:31:50.079Z","avatar_url":"https://github.com/wechatjs.png","language":"HTML","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"English | [简体中文](./README_CN.md)\n\nmp-darkmode\n==============================\n[![NPM version][npm-image]][npm-url]\n\nThe Dark Mode conversion algorithm for WeChat Official Accounts Platform.\n\n## Start\n\n### 1. Download\n\nDownload the [latest release](https://github.com/wechatjs/mp-darkmode/releases).\n\nOr, install via `npm`:\n\n```shell\nnpm i mp-darkmode\n```\n\n### 2. Import\n\n(1) Under non-AMD/CMD rule, insert mp-darkmode into `\u003chead\u003e`.\n\n```html\n\u003cscript src=\"path/to/darkmode.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  // run dark mode conversion algorithm\n  Darkmode.run(document.body.querySelectorAll('*')); // process all DOM nodes under body\n\u003c/script\u003e\n```\n\n(2) Under AMD/CMD rule, use `require()` to import mp-darkmode.\n\n```javascript\nvar Darkmode = require('path/to/darkmode.min.js');\n\n// run dark mode conversion algorithm\nDarkmode.run(document.body.querySelectorAll('*')); // process all DOM nodes under body\n```\n\n## Usage\n\n### `Darkmode.run(nodes[, options])`\n\n- `nodes` \u0026lt;DOM Object Array\u0026gt; The DOM to be converted.\n- `options` \u0026lt;Object\u0026gt; Configuration.\n  - `options.error` \u0026lt;Function\u0026gt; Callback triggered when an error occurs.\n    - `err` \u0026lt;Error\u0026gt; Error object.\n  - `options.mode` \u0026lt;string\u0026gt; The specified color mode (dark | light), if specified, the system color will not be monitored.\n  - ...\n  - ...\n  - ...\n\nRun Dark Mode conversion algorithm.\n\n```javascript\nDarkmode.run(document.body.querySelectorAll('*'), {\n  mode: 'dark', // force dark mode\n  ... // other configuration items\n});\n```\n\nMore detailed usage can refer to [API](./doc/en/API.md).\n\n## Plugins\n\nPlugins are supported since `v1.1.0`. Custom actions can be performed during transformation, such as filtering DOM attributes. How to use the plugin is as follows:\n\n```javascript\nDarkmode.extend([pluginA, pluginB, pluginC]);\n```\n\nIf you want to write your own Dark Mode plugin, you can refer to [here](./doc/en/plugins.md)。\n\n## Contribution\n\nThe algorithm is constantly updated and optimized. If you have a good idea, you can fork and submit your code. For specific development, please refer to [Development Guide](./doc/en/develop.md).\n\n[npm-url]: https://www.npmjs.com/package/mp-darkmode\n[npm-image]: https://img.shields.io/npm/v/mp-darkmode.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwechatjs%2Fmp-darkmode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwechatjs%2Fmp-darkmode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwechatjs%2Fmp-darkmode/lists"}