{"id":19532680,"url":"https://github.com/mobilerast/javascript-energy-consumption","last_synced_at":"2025-02-26T03:35:57.760Z","repository":{"id":214479290,"uuid":"736611543","full_name":"mobilerast/javascript-energy-consumption","owner":"mobilerast","description":"EnergySaver.js is a lightweight, easy-to-integrate JavaScript library designed to provide real-time energy consumption estimates based on the theme (dark or light) used on a website. It visually represents the estimated energy savings of using a dark theme over a light theme, enhancing user awareness about energy-efficient practices","archived":false,"fork":false,"pushed_at":"2023-12-28T12:15:50.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T17:21:59.605Z","etag":null,"topics":["dark-mode","dark-theme","energy","energy-consumption","energy-efficiency","javascript","javascript-library","javascript-vanilla","js","js-library","library","light-mode"],"latest_commit_sha":null,"homepage":"https://mobilerast.github.io/javascript-energy-consumption/","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/mobilerast.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}},"created_at":"2023-12-28T11:26:50.000Z","updated_at":"2023-12-28T12:19:43.000Z","dependencies_parsed_at":"2024-01-05T00:32:14.390Z","dependency_job_id":null,"html_url":"https://github.com/mobilerast/javascript-energy-consumption","commit_stats":null,"previous_names":["mobilerast/javascript-energy-consumption"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobilerast%2Fjavascript-energy-consumption","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobilerast%2Fjavascript-energy-consumption/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobilerast%2Fjavascript-energy-consumption/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobilerast%2Fjavascript-energy-consumption/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mobilerast","download_url":"https://codeload.github.com/mobilerast/javascript-energy-consumption/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240788712,"owners_count":19857691,"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":["dark-mode","dark-theme","energy","energy-consumption","energy-efficiency","javascript","javascript-library","javascript-vanilla","js","js-library","library","light-mode"],"created_at":"2024-11-11T01:54:13.732Z","updated_at":"2025-02-26T03:35:57.733Z","avatar_url":"https://github.com/mobilerast.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# EnergySaver.js Library\n\n## Overview\n\nEnergySaver.js is a lightweight, easy-to-integrate JavaScript library designed to provide real-time energy consumption estimates based on the theme (dark or light) used on a website. It visually represents the estimated energy savings of using a dark theme over a light theme, enhancing user awareness about energy-efficient practices in digital environments.\n\n## Features\n\n- **Real-Time Energy Consumption Estimates**: Continuously displays the estimated energy consumption savings when using a dark theme.\n- **Automatic Theme Detection**: Adjusts calculations based on the current theme (dark or light).\n- **Easy Integration**: Simple to add to any existing website with minimal setup.\n- **Customizable**: Easily adjustable parameters for different power consumption values or display settings.\n\n## How to Set Up\n\n### Step 1: Include the Library\n\nFirst, include `EnergySaver.js` in your HTML file. Place the script tag in the `\u003chead\u003e` or at the end of the `\u003cbody\u003e`:\n\n```html\n\u003cscript src=\"/EnergySaver.js\"\u003e\u003c/script\u003e\n```\n\n### Step 2: Initialize the Library\n\nCreate an instance of the `EnergySaver` class, passing the ID of your theme toggle checkbox:\n\n```html\n\u003cscript\u003e\n    const energySaver = new EnergySaver('your-checkbox-id');\n\u003c/script\u003e\n```\n\nReplace `'your-checkbox-id'` with the actual ID of your theme toggle checkbox element.\n\n### Step 3: Add the Checkbox\n\nEnsure you have a checkbox for theme toggling:\n\n```html\n\u003clabel class=\"theme-switch\" for=\"theme-checkbox\"\u003e\n    \u003cinput type=\"checkbox\" id=\"theme-checkbox\" /\u003e\n    \u003cdiv class=\"slider round\"\u003e\u003c/div\u003e\n\u003c/label\u003e\n```\n\n### Step 4: Style as Needed\n\nCustomize the appearance of the energy consumption display using CSS.\n\n## Benefits\n\n- **Enhances User Engagement**: By displaying real-time data, it keeps users engaged and informed about their energy usage.\n- **Promotes Energy Efficiency**: Encourages the use of dark themes, which can be more energy-efficient on certain types of screens.\n- **Easy to Understand**: Provides a simple and clear visual representation of energy consumption, making it accessible to all users.\n- **Customizable**: Can be easily tailored to fit the design and energy parameters of any website.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Author and Contact\n\n- **GitHub**: [mobilerast](https://github.com/mobilerast)\n- **Email**: [mehmet.alp@rastmobile.com](mailto:mehmet.alp@rastmobile.com), [contact@rastmobile.com](mailto:contact@rastmobile.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobilerast%2Fjavascript-energy-consumption","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmobilerast%2Fjavascript-energy-consumption","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobilerast%2Fjavascript-energy-consumption/lists"}