{"id":16439387,"url":"https://github.com/huangshuwei/theme-switcher-tool","last_synced_at":"2026-04-30T12:32:22.959Z","repository":{"id":100223048,"uuid":"267191896","full_name":"huangshuwei/theme-switcher-tool","owner":"huangshuwei","description":"theme switcher tool","archived":false,"fork":false,"pushed_at":"2021-02-07T16:28:05.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-25T22:31:36.606Z","etag":null,"topics":["react","switcher","theme","vuejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huangshuwei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-05-27T01:34:13.000Z","updated_at":"2021-02-07T16:27:31.000Z","dependencies_parsed_at":"2023-05-09T11:01:09.639Z","dependency_job_id":null,"html_url":"https://github.com/huangshuwei/theme-switcher-tool","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/huangshuwei/theme-switcher-tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huangshuwei%2Ftheme-switcher-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huangshuwei%2Ftheme-switcher-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huangshuwei%2Ftheme-switcher-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huangshuwei%2Ftheme-switcher-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huangshuwei","download_url":"https://codeload.github.com/huangshuwei/theme-switcher-tool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huangshuwei%2Ftheme-switcher-tool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32465009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"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":["react","switcher","theme","vuejs"],"created_at":"2024-10-11T09:09:08.247Z","updated_at":"2026-04-30T12:32:22.941Z","avatar_url":"https://github.com/huangshuwei.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Theme Switcher Tool\n\n[![NPM version](https://img.shields.io/npm/v/theme-switcher-tool.svg?style=flat)](https://npmjs.org/package/theme-switcher-tool)\n[![NPM downloads](http://img.shields.io/npm/dm/theme-switcher-tool.svg?style=flat)](https://npmjs.org/package/theme-switcher-tool)\n\ntheme switcher tool.\nthese are examples with [theme-generator-webpack-plugin](https://github.com/huangshuwei/theme-generator-webpack-plugin)\n- [base on react antd demo](http://doc.huangsw.com/theme-generator-webpack-plugin/react-antd/)\n- [base on vue element demo](http://doc.huangsw.com/theme-generator-webpack-plugin/vue-element/)\n\n\n### Install\n\n**Browser Environment**\n\n```\n\u003cscript src=\"//unpkg.com/theme-switcher-tool\"\u003e\u003c/script\u003e\n```\n\n**ES Module Environment**\n\n```\nyarn add theme-switcher-tool\n```\n\nor\n\n```\nnpm install theme-switcher-tool\n```\n\n### Usage\n\n```\nimport ThemeSwitcherTool from 'theme-switcher-tool';\n```\n\n```\n\nconst themeSwitcherTool = ThemeSwitcherTool({\n    // Your theme list\n    themeList: [\n                { themeName: \"theme-default\", themePath: \"https://unpkg.com/vue-easytable/libs/theme-default/index.css\" },\n                { themeName: \"theme-dark\", themePath: \"https://unpkg.com/vue-easytable/libs/theme-dark/index.css\" },\n            ],\n    // Your actual style id\n    styleLinkId: \"theme_creator_cli_style_id\",\n    useStorage: true,\n    storageKey: \"theme_switcher_tool_theme\"\n});\n\nconst historyTheme = themeSwitcherTool.getCurrentTheme() || \"theme-dark\";\n\n/*\nswitcher theme\n1、you can show your loading message\n*/\nthemeSwitcherTool.switcher({\n    themeName: historyTheme\n}).then(()=\u003e{\n\n    // somthing to do. such as close your loading message\n})\n\n```\n\n### API\n**config**\n| 参数      | 说明                              | 类型      | 可选值            | 默认值  | 参考值  |\n|---------- |--------------------------------- |---------- |----------------  |-------- |-------- |\n| `themeList` | 需要切换的主题列表 | `{Array\u003cObject\u003e}` | — | — | `[{\"themeName\":\"theme-black\",\"themePath\":\"./themes/theme-black.css\"},{\"themeName\":\"theme-blue\",\"themePath\":\"./themes/theme-blue.css\"}]` |\n| `styleLinkId` | html`link`标签id | `{String}` | — | — | `theme_creator_cli_style_id` |\n| `useStorage` | 是否使用 `localStorage`记录当前主题名称 | `{Bool}` | — | `false` | —  |\n| `storageKey` | `localStorage` key 值 | `{String}` | — | —  | —  |\n\n**methods**\n| 名称      | 说明                              | 参数      | 返回值类型            |\n|--------- |--------------------------------- |---------- |----------------  |\n| `getCurrentTheme` | 返回当前主题名称（当设置了 `localStorage` 存储） | —  | `{String}`|\n| `switcher` | 切换主题 | `themeName` | `{String}` | — |\n\n## License\nThis project is licensed under [MIT](http://www.opensource.org/licenses/mit-license.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuangshuwei%2Ftheme-switcher-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuangshuwei%2Ftheme-switcher-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuangshuwei%2Ftheme-switcher-tool/lists"}