{"id":13808387,"url":"https://github.com/rumkin/favicon-switcher","last_synced_at":"2025-07-27T04:31:29.751Z","repository":{"id":57233557,"uuid":"207230900","full_name":"rumkin/favicon-switcher","owner":"rumkin","description":"Make favicon react on media queries","archived":false,"fork":false,"pushed_at":"2020-01-17T14:42:28.000Z","size":73,"stargazers_count":80,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-19T00:44:20.849Z","etag":null,"topics":["favicon","site","theming","ui","utils"],"latest_commit_sha":null,"homepage":"https://rumkin.github.io/favicon-switcher/","language":"JavaScript","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/rumkin.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}},"created_at":"2019-09-09T05:30:13.000Z","updated_at":"2022-08-08T18:37:42.000Z","dependencies_parsed_at":"2022-08-31T14:11:37.866Z","dependency_job_id":null,"html_url":"https://github.com/rumkin/favicon-switcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Ffavicon-switcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Ffavicon-switcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Ffavicon-switcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Ffavicon-switcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rumkin","download_url":"https://codeload.github.com/rumkin/favicon-switcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227759979,"owners_count":17815626,"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":["favicon","site","theming","ui","utils"],"created_at":"2024-08-04T01:01:41.591Z","updated_at":"2024-12-02T16:12:35.620Z","avatar_url":"https://github.com/rumkin.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Favicon Switcher\n\n[Live preview](https://rumkin.github.io/favicon-switcher)\n\n\u003cimg width=\"290\" src=\"assets/example-light.png\" alt=\"Light mode favicon example\" /\u003e\n\u003cimg width=\"290\" src=\"assets/example-dark.png\" alt=\"Dark mode favicon example\" /\u003e\n\nSwitches site's favicon by matching media queries. It could be used for\nlight/dark mode switching. Due to browsers don't support all Media Query\nfeatures in link tag, this module fixes it.\n\n## Usage\n\nScript doesn't require any setup or configuration and works like a polyfill.\nThe example below shows how to make dark/light mode icon switching.\n\nUse the main library to automatically turn icon switching on:\n\n```html\n\u003cscript src=\"https://unpkg.com/favicon-switcher@1.2.2/dist/index.js\" crossorigin=\"anonymous\" type=\"application/javascript\"\u003e\u003c/script\u003e\n```\n\nIf you need more control to turn switching on and off use one of the next\nmodule:\n\n### UMD\n\nUse with UMD:\n\n```html\n\u003cscript src=\"https://unpkg.com/favicon-switcher@1.2.2/dist/index.umd.js\" crossorigin=\"anonymous\" type=\"application/javascript\"\u003e\u003c/script\u003e\n\u003cscript\u003efaviconSwitcher()\u003c/script\u003e\n```\n\n### ESM\n\nUse as ES module:\n\n```html\n\u003cscript type=\"module\" language=\"javascript\"\u003e\n  import initSwitcher from 'https://unpkg.com/favicon-switcher@1.2.2/dist/index.esm.js'\n\n  // Subscribe to media queries changing events\n  const unsubscribe = initSwitcher()\n  // Unsubscribe later on some condition. For example on page navigation.\n  unsubscribe()\n\u003c/script\u003e\n```\n\n## Complete example\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\" dir=\"ltr\"\u003e\n  \u003chead\u003e\n    \u003clink rel=\"icon\" media=\"(prefers-color-scheme:dark)\" href=\"favicon-dark.png\" type=\"image/png\" /\u003e\n    \u003clink rel=\"icon\" media=\"(prefers-color-scheme:light)\" href=\"favicon-light.png\" type=\"image/png\" /\u003e\n    \u003cscript src=\"https://unpkg.com/favicon-switcher@1.2.2/dist/index.js\" crossorigin=\"anonymous\" type=\"application/javascript\"\u003e\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\n## License\n\nMIT © [Rumkin](https://rumk.in)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Ffavicon-switcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frumkin%2Ffavicon-switcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Ffavicon-switcher/lists"}