{"id":15314239,"url":"https://github.com/barelyhuman/themer","last_synced_at":"2025-10-12T07:45:56.942Z","repository":{"id":42049122,"uuid":"345224284","full_name":"barelyhuman/themer","owner":"barelyhuman","description":"Graceful dark mode support in vanilla javascript","archived":false,"fork":false,"pushed_at":"2023-08-30T18:11:24.000Z","size":313,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"dev","last_synced_at":"2025-10-02T15:44:54.864Z","etag":null,"topics":["dark-mode","javascript","library","productivity"],"latest_commit_sha":null,"homepage":"https://themer.barelyhuman.dev","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/barelyhuman.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},"funding":{"liberapay":"reaper","ko_fi":"barelyreaper","github":"barelyhuman","custom":"https://barelyreaper.gumroad.com/coffee"}},"created_at":"2021-03-07T00:22:57.000Z","updated_at":"2025-05-03T08:24:38.000Z","dependencies_parsed_at":"2025-02-26T15:37:32.346Z","dependency_job_id":"1ea5c8d7-1955-4b72-ae3b-41384295f0bb","html_url":"https://github.com/barelyhuman/themer","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/barelyhuman/themer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Fthemer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Fthemer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Fthemer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Fthemer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barelyhuman","download_url":"https://codeload.github.com/barelyhuman/themer/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barelyhuman%2Fthemer/sbom","scorecard":{"id":225802,"data":{"date":"2025-08-11","repo":{"name":"github.com/barelyhuman/themer","commit":"c304a7ec53ed813b92b56e9aff5bc210a3518281"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/10 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/barelyhuman/themer/release.yml/dev?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/barelyhuman/themer/release.yml/dev?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/barelyhuman/themer/release.yml/dev?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/barelyhuman/themer/test.yml/dev?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/barelyhuman/themer/test.yml/dev?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/barelyhuman/themer/test.yml/dev?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/test.yml:22","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'dev'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"19 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-xq7p-g2vc-g82p","Warn: Project is vulnerable to: GHSA-7hpj-7hhx-2fgx"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T03:47:06.577Z","repository_id":42049122,"created_at":"2025-08-17T03:47:06.582Z","updated_at":"2025-08-17T03:47:06.582Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010676,"owners_count":26084785,"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-10-12T02:00:06.719Z","response_time":53,"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":["dark-mode","javascript","library","productivity"],"created_at":"2024-10-01T08:44:50.149Z","updated_at":"2025-10-12T07:45:56.928Z","avatar_url":"https://github.com/barelyhuman.png","language":"TypeScript","funding_links":["https://liberapay.com/reaper","https://ko-fi.com/barelyreaper","https://github.com/sponsors/barelyhuman","https://barelyreaper.gumroad.com/coffee"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/themer.png\" height=\"64\"\u003e\n\u003cp align=\"center\"\u003eGraceful dark mode support in vanilla javascript\u003c/p\u003e\n\n \u003cp\u003e\n \u003ca href=\"https://www.npmjs.com/package/@barelyreaper/themer\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@barelyreaper/themer?style=flat\u0026amp;colorA=000000\u0026amp;colorB=000000\" alt=\"Version\"\u003e\u003c/a\u003e\n \u003ca href=\"https://www.npmjs.com/package/@barelyreaper/themer\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/@barelyreaper/themer.svg?style=flat\u0026amp;colorA=000000\u0026amp;colorB=000000\" alt=\"Downloads\"\u003e\u003c/a\u003e\n \u003c/p\u003e\n\n## How ?\n\nby adding `data-theme` attribute to the `body` tag on the document, aka you can use css selectors to either use custom css or use system preference, in case there's no JS\n\n## Mandatory 4 Feature points\n\n- Tiny , it's (3KB unminified,1KB minified, check `.sizesnap.json` for exact size details) and the type definitions take the most space, so you can technically avoid them altogether based on your bundler\n- Available in ESM,CJS,UMD(as a cdn file) , so i don't care what bundler you use, or if you don't use bundlers at all.\n- Backed by Tests, like every other library out there\n- One of the few libraries that doesn't render useless when javascript is disabled, you need to tweak your css a bit, but you handle system preference theming pretty easily.\n\nNot Convinced? Okay.\n\n## Usage\n\nYou can use it via a CDN like unpkg or via npm using\n\n**Note: The library is an ES Module and thus needs to either be used by a web bundler or using `\u003cscript type=\"module\"\u003e` in vanilla HTML.**\n\n```sh\nnpm i @barelyreaper/themer\n# or\nyarn add @barelyreaper/themer\n```\n\nThen in your js file.\n\n```js\nimport {\n\tinit, // adds a listener for handling browser's preference changes and the initial loading state\n\tgetCurrentTheme, // get the current theme string from storage, this could be any string value that you set from `setTheme`\n\tsetTheme, // provides a simple function to store the theme preference in the localStorage\n} from '@barelyreaper/themer'\n```\n\n```html\n\u003c!-- might wanna version lock the url by opening it in the browser first to get a version tagged url --\u003e\n\u003cscript src=\"https://unpkg.com/@barelyreaper/themer/index.browser.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n\tconst {init, getCurrentTheme, setTheme} = themer\n\n\tconst unsub = init({\n\t\tlightPref: 'light', // default light preference\n\t\tdarkPref: 'dark', // default dark preference\n\t\tonChange: () =\u003e {\n\t\t\tconst theme = getCurrentTheme()\n\t\t\tconsole.log('theme changed to:',${theme})\n\t\t\t// reset icons\n\t\t\t// move toggles, etc etc\n\t\t},\n\t})\n\n\tsetTheme('light') // set theme to use `light` colors\n\tsetTheme('dark') // set theme to use `dark` colors\n\tsetTheme('rose') // set theme to use `rose` colors\n\tsetTheme('') // set theme to use system defined themes\n\n\t// unsub on destruction of your component or page\n\t// if necessary\n\tunsub()\n\u003c/script\u003e\n```\n\nWrite the css classes with respect to the existence of `data-theme` attribute on the body tag\n\n```css\n/* set a theme for both default state and the light theme */\nbody,\nbody[data-theme='light'] {\n\t--bg: #eceff4;\n\t--bg-light: #e5e9f0;\n\t--bg-lighter: #d8dee9;\n\t--fg: #2e3440;\n\t--fg-light: #3b4252;\n\t--fg-lighter: #434c5e;\n\t--shadow: 0 1px 4px rgba(0, 0, 0, 0.12);\n}\n\nbody[data-theme='dark'] {\n\t--bg: #121212;\n\t--bg-light: #191919;\n\t--bg-lighter: #252525;\n\t--fg: #d8dee9;\n\t--fg-light: #e5e9f0;\n\t--fg-lighter: #eceff4;\n\t--shadow: rgb(15 17 21 / 20%) 0px 3px 6px 0px;\n}\n\nbody[data-theme='rose'] {\n\t--bg: #faf4ed;\n\t--bg-light: #fffaf3;\n\t--bg-lighter: #f2e9e1;\n\t--fg: #575279;\n\t--fg-light: #797593;\n\t--fg-lighter: #9893a5;\n\t--shadow: rgb(15 17 21 / 20%) 0px 3px 6px 0px;\n}\n\n/* Default dark mode if no JS is present */\n@media (prefers-color-scheme: dark) {\n\tbody:not([data-theme]) {\n\t\t--bg: #121212;\n\t\t--bg-light: #191919;\n\t\t--bg-lighter: #252525;\n\t\t--fg: #d8dee9;\n\t\t--fg-light: #e5e9f0;\n\t\t--fg-lighter: #eceff4;\n\t\t--shadow: rgb(15 17 21 / 20%) 0px 3px 6px 0px;\n\t}\n}\n```\n\n## Dev\n\n```sh\npnpm i # Install deps\npnpm dev # Run the dev watcher\npnpm web:dev # start the web server that can be used to test the bundled library\n```\n\n## Build\n\n```sh\npnpm build\n```\n\n# Contribute\n\n- pick up an issue from the issues (do comment on the issues to avoid overlaps)\n- fork the repo\n- clone it\n- do your magic\n- raise a PR!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarelyhuman%2Fthemer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarelyhuman%2Fthemer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarelyhuman%2Fthemer/lists"}