{"id":23909817,"url":"https://github.com/nrcool/log-animate","last_synced_at":"2026-01-06T07:03:00.971Z","repository":{"id":257178150,"uuid":"857533902","full_name":"nrcool/log-animate","owner":"nrcool","description":"This package enables developers to easily display dynamic animations, progress bars, timers, and styled messages in the console.","archived":false,"fork":false,"pushed_at":"2024-09-15T07:58:39.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-22T04:51:28.894Z","etag":null,"topics":["javascript","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/log-animate","language":"JavaScript","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/nrcool.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-14T22:37:26.000Z","updated_at":"2024-09-15T08:03:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"a6767fd4-ee9a-46c5-8823-0e6f8eaeab5b","html_url":"https://github.com/nrcool/log-animate","commit_stats":null,"previous_names":["nrcool/log-animate"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nrcool/log-animate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrcool%2Flog-animate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrcool%2Flog-animate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrcool%2Flog-animate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrcool%2Flog-animate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nrcool","download_url":"https://codeload.github.com/nrcool/log-animate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrcool%2Flog-animate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28223115,"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":"2026-01-06T02:00:07.049Z","response_time":56,"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":["javascript","nodejs"],"created_at":"2025-01-05T06:33:35.969Z","updated_at":"2026-01-06T07:03:00.959Z","avatar_url":"https://github.com/nrcool.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# log-animate\n\n[![VERSION](https://img.shields.io/badge/version-1.0.1-brightgreen)](https://www.npmjs.com/package/log-animate)\n\n[![LICENSE](https://img.shields.io/badge/LICENSE-MIT-orange)](https://www.npmjs.com/package/log-animate)\n\n[![AUTHOR](https://img.shields.io/badge/AUTHOR-NAQVI-yellow)](https://www.npmjs.com/package/log-animate)\n\n# log-animate\n\n`log-animate` is a lightweight, zero-dependency logging utility, thoughtfully crafted by **Naqvi**. This package enables developers to easily display dynamic animations, progress bars, timers, and styled messages in the console. Built entirely from scratch without the use of any external libraries, `log-animate` offers a simple yet powerful way to enhance terminal output with customizable text and background colors.\n\n## Key Features:\n- **Zero dependencies**: Fully self-contained, with no reliance on external packages.\n- **Customizable console output**: Effortlessly modify text and background colors to suit your needs.\n- **Dynamic animations**: Includes built-in support for loading animations, progress bars, timers, and spinners.\n\n\n## Installation 🏭\n\nTo install the package, run the following command:\n\n```bash\nnpm install log-animate\n```\n\n## Usage 😃\n\n### Importing the log package\n\n```javascript\nimport logAnimate, {logEnd} from \"log-animate\";\n```\n\n### Example 1: Loading Animation ⌛\n\nThis example demonstrates how to show a loading animation in the console.\n\n```javascript\nconst loader = [\n  \"loading .\",\n  \"loading . .\",\n  \"loading . . .\",\n  \"loading . . . .\",\n  \"loading . . . . .\",\n];\nlet index = 0;\n\nsetInterval(() =\u003e {\n  const item = loader[index++ % loader.length];\n  logAnimate(item);\n}, 1000);\n```\n\n### Example 2: Progress Bar 🟩🟩🟩🟩🟩\n\nThis example simulates a progress bar, updating every second.\n\n```javascript\nconst progress = [\"🟩\", \"🟩🟩\", \"🟩🟩🟩\", \"🟩🟩🟩🟩\", \"🟩🟩🟩🟩🟩\"];\nlet count = 0;\n\nlet intervalProgress = setInterval(() =\u003e {\n  const item = progress[count++ % progress.length];\n  logAnimate(`Progress : [${[item]}${\"  \".repeat(progress.length - count)}] ${count * 20}%`);\n  \n  if (count === progress.length) {\n    clearInterval(intervalProgress);\n    logEnd()\n  }\n}, 1000);\n```\n\n### Example 3: Timer Animation ⏰\n\nDisplays a timer that cycles through different clock emojis and times.\n\n```javascript\nconst timerLoader = [\n  \"🕧\", \"🕐\", \"🕛\", \"🕜\", \"🕑\", \"🕝\", \"🕒\", \"🕞\", \"🕓\", \"🕟\", \n  \"🕔\", \"🕠\", \"🕕\", \"🕡\", \"🕖\", \"🕢\", \"🕗\", \"🕣\", \"🕘\", \"🕤\",\n  \"🕙\", \"🕥\", \"🕚\", \"🕦\", \"🕧\"\n];\n\nconst times = [\n  \"12:00\", \"12:30\", \"01:00\", \"01:30\", \"02:00\", \"02:30\", \"03:00\", \"03:30\",\n  \"04:00\", \"04:30\", \"05:00\", \"05:30\", \"06:00\", \"06:30\", \"07:00\", \"07:30\",\n  \"08:00\", \"08:30\", \"09:00\", \"09:30\", \"10:00\", \"10:30\", \"11:00\", \"11:30\", \"12:00\"\n];\n\nlet index = 0;\n\nlet interval = setInterval(() =\u003e {\n  const item = timerLoader[index % timerLoader.length];\n  logAnimate(`Timer : ${[item]} ${times[index]}`);\n  index++;\n\n  if (index === timerLoader.length) {\n    clearInterval(interval);\n    logEnd()\n  }\n}, 1000);\n```\n\n### Example 4: Spinner 🌀\n\nDisplays a simple spinning animation.\n\n```javascript\nconst spinner = [\"-\", \"\\\\\", \"|\", \"/\"];\nlet step = 0;\n\nsetInterval(() =\u003e {\n  const item = spinner[step++ % spinner.length];\n  logAnimate(`Spinner: ${item}`);\n}, 100);\n```\n\n### Logging with Custom Background and Text Color\n\nYou can pass optional arguments to specify background and text colors:\n\n```javascript\nlogAnimate(\"Hello World!\", \"green\", \"black\");\n```\n\nIn this example:\n- The text \"Hello World!\" will be displayed with a green background and black text.\n\nThe available colors are defined in the ANSI color map and can include options such as `red`, `green`, `yellow`, `blue`, etc.\n\n### Example 5: Real-Time Clock 1⩇:2⩇\n\nLogs the current UTC time every second with a green background.\n\n```javascript\nsetInterval(() =\u003e {\n  logAnimate(new Date().toUTCString(), \"white\",\"green\");\n}, 1000);\n``` \n\n### Example 6: Displaying Logs on Separate Lines with Custom Colors\n\nIf you want to print each log on a separate line, you can use the `logEnd()` function after each `logAnimate` call. This ensures that every log message is followed by a line break.\n\n```javascript\nimport logAnimate,{logEnd } from \"log-animate\";\n\n// Log the first message with a red background and white text\nlogAnimate(\"First Log Message\", \"red\", \"white\");\nlogEnd(); // Ends the first log and moves to a new line\n\n// Log the second message with a blue background and white text\nlogAnimate(\"Second Log Message\", \"blue\", \"white\");\nlogEnd(); // Ends the second log and moves to a new line\n```\n\nThis example will display the first log message, move to the next line, and then display the second log message on a new line.\n\n### Result:\n\n- The first log (`\"First Log Message\"`) is printed with a red background and white text, followed by a line break.\n- The second log (`\"Second Log Message\"`) is printed on the next line with a blue background and white text.\n\nBy using `logEnd()`, you ensure that each log message ends and moves to the next line, as expected.\n\n\n## Author ✍️\n[**Naqvi 🇩🇪  **](https://github.com/nrcool)\n\n## Contribute 🤝\n\nYou can fork this repo and send me a PR.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrcool%2Flog-animate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnrcool%2Flog-animate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrcool%2Flog-animate/lists"}