{"id":29669464,"url":"https://github.com/egamagz/temo","last_synced_at":"2026-04-09T21:11:44.343Z","repository":{"id":303030815,"uuid":"1012924711","full_name":"EGAMAGZ/temo","owner":"EGAMAGZ","description":"Temo is a minimal and intuitive JavaScript/TypeScript library for managing light/dark themes in web applications.","archived":false,"fork":false,"pushed_at":"2025-07-05T09:08:45.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-05T09:25:47.593Z","etag":null,"topics":["bun","deno","jsr","nodejs","theme","theme-switcher"],"latest_commit_sha":null,"homepage":"","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/EGAMAGZ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null}},"created_at":"2025-07-03T05:20:27.000Z","updated_at":"2025-07-05T09:07:40.000Z","dependencies_parsed_at":"2025-07-05T09:35:59.943Z","dependency_job_id":null,"html_url":"https://github.com/EGAMAGZ/temo","commit_stats":null,"previous_names":["egamagz/temo"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/EGAMAGZ/temo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EGAMAGZ%2Ftemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EGAMAGZ%2Ftemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EGAMAGZ%2Ftemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EGAMAGZ%2Ftemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EGAMAGZ","download_url":"https://codeload.github.com/EGAMAGZ/temo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EGAMAGZ%2Ftemo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266552804,"owners_count":23947184,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["bun","deno","jsr","nodejs","theme","theme-switcher"],"created_at":"2025-07-22T18:36:10.760Z","updated_at":"2026-04-09T21:11:44.338Z","avatar_url":"https://github.com/EGAMAGZ.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Temo\n\nTemo is a minimal and intuitive JavaScript/TypeScript library for managing\nlight/dark themes in web applications.\n\n[![JSR](https://jsr.io/badges/@egamagz/temo)](https://jsr.io/@egamagz/temo)\n[![JSR Score](https://jsr.io/badges/@egamagz/temo/score)](https://jsr.io/@egamagz/temo/score)\n![GitHub License](https://img.shields.io/github/license/egamagz/temo)\n![GitHub Release](https://img.shields.io/github/v/release/egamagz/temo)\n\n## Installation\n\n### For Deno\n\n```bash\ndeno add jsr:@egamagz/temo\n```\n\n### For Node.js\n\n```bash\nnpx jsr add @egamagz/temo\n```\n\n### For Bun\n\n```bash\nbunx jsr add @egamagz/temo\n```\n\n### For other package managers\n\nCheck the [JSR page for more details](https://jsr.io/@egamagz/temo).\n\n## Features\n\n- 🌙 **Light/Dark Theme Toggle**: Seamlessly switch between light and dark\n  themes\n- 🔍 **Auto-Detection**: Automatically detects user's system theme preference\n- 💾 **Persistent Storage**: Remembers user's theme choice using localStorage\n- 🎯 **Simple API**: Easy-to-use singleton pattern with minimal configuration\n- 🔗 **Element Binding**: Bind theme toggle to any button element\n- 🎨 **Custom Storage Key**: Use custom localStorage keys for theme storage\n- 🔄 **Theme Change Callbacks**: React to theme changes with custom callbacks\n- 🧹 **Clean Destruction**: Properly clean up event listeners when needed\n\n## Usage\n\n### Basic Usage\n\n```typescript\nimport { Temo } from \"@egamagz/temo\";\n\n// Initialize with default configuration\nconst temo = Temo.init({\n  autoDetect: true, // Auto-detect system theme preference\n  defaultTheme: \"light\", // Default theme when no preference is found\n  storageKey: \"theme\", // localStorage key for theme persistence\n});\n\n// Toggle theme programmatically\ntemo.toggle();\n```\n\n### Advanced Configuration\n\n```typescript\nimport { Temo } from \"@egamagz/temo\";\n\nconst temo = Temo.init({\n  autoDetect: true,\n  defaultTheme: \"dark\",\n  storageKey: \"my-app-theme\",\n  onThemeChange: (theme) =\u003e {\n    console.log(`Theme changed to: ${theme}`);\n    // Update other UI elements based on theme\n    updateNavbarStyle(theme);\n  },\n});\n```\n\n### Binding to Toggle Button\n\n```typescript\n// HTML\n// \u003cbutton id=\"theme-toggle\"\u003eToggle Theme\u003c/button\u003e\n\n// JavaScript/TypeScript\nconst temo = Temo.init({\n  autoDetect: true,\n  defaultTheme: \"light\",\n});\n\n// Bind the toggle functionality to a button\ntemo.bindToggle(\"#theme-toggle\");\n```\n\n### CSS Implementation\n\nTemo sets a `data-theme` attribute on the document element. Use this in your\nCSS:\n\n```css\n/* Light theme (default) */\n:root {\n  --bg-color: #ffffff;\n  --text-color: #000000;\n  --accent-color: #007bff;\n}\n\n/* Dark theme */\n[data-theme=\"dark\"] {\n  --bg-color: #1a1a1a;\n  --text-color: #ffffff;\n  --accent-color: #66b3ff;\n}\n\n/* Apply the variables */\nbody {\n  background-color: var(--bg-color);\n  color: var(--text-color);\n  transition: background-color 0.3s ease, color 0.3s ease;\n}\n\n.button {\n  background-color: var(--accent-color);\n  color: var(--bg-color);\n}\n```\n\n## API Reference\n\n### `Temo.init(config: TemoConfigInit): Temo`\n\nInitializes the Temo singleton instance.\n\n**Parameters:**\n\n- `config.autoDetect?: boolean` - Enable automatic system theme detection\n  (default: `true`)\n- `config.defaultTheme?: \"light\" | \"dark\"` - Default theme when no preference is\n  found (default: `\"light\"`)\n- `config.storageKey?: string` - localStorage key for theme persistence\n  (default: `\"theme\"`)\n- `config.onThemeChange?: (theme: Theme) =\u003e void` - Callback function called\n  when theme changes\n\n### `temo.toggle(): void`\n\nToggles between light and dark themes.\n\n### `temo.bindToggle(selector: Selector): void`\n\nBinds theme toggle functionality to an element.\n\n**Parameters:**\n\n- `selector: Selector` - ID selector (e.g., `\"#toggleBtn\"`)\n\n### `temo.destroy(): void`\n\nCleans up event listeners and aborts any ongoing operations.\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegamagz%2Ftemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegamagz%2Ftemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegamagz%2Ftemo/lists"}