{"id":15713370,"url":"https://github.com/littletof/snapper","last_synced_at":"2026-02-13T05:04:54.459Z","repository":{"id":50586588,"uuid":"418541988","full_name":"littletof/snapper","owner":"littletof","description":"ANSI formatted text to image","archived":false,"fork":false,"pushed_at":"2022-07-30T15:04:35.000Z","size":616,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-08T00:26:37.295Z","etag":null,"topics":["deno","hacktoberfest","puppeteer","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/littletof.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"ko_fi":"littletof","custom":["https://www.buymeacoffee.com/littletof","https://coindrop.to/littletof"]}},"created_at":"2021-10-18T14:38:51.000Z","updated_at":"2022-08-17T02:01:10.000Z","dependencies_parsed_at":"2022-09-14T13:12:08.494Z","dependency_job_id":null,"html_url":"https://github.com/littletof/snapper","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/littletof/snapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littletof%2Fsnapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littletof%2Fsnapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littletof%2Fsnapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littletof%2Fsnapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/littletof","download_url":"https://codeload.github.com/littletof/snapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littletof%2Fsnapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29396847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T04:26:15.637Z","status":"ssl_error","status_checked_at":"2026-02-13T04:16:29.732Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["deno","hacktoberfest","puppeteer","typescript"],"created_at":"2024-10-03T21:22:26.761Z","updated_at":"2026-02-13T05:04:54.435Z","avatar_url":"https://github.com/littletof.png","language":"TypeScript","funding_links":["https://ko-fi.com/littletof","https://www.buymeacoffee.com/littletof","https://coindrop.to/littletof"],"categories":[],"sub_categories":[],"readme":"# Snapper 📷\n[![deno badge](https://img.shields.io/badge/deno.land/x-success?logo=deno\u0026logoColor=black\u0026labelColor=white\u0026color=black)](https://deno.land/x/snapper)\n[![snapper_deno](https://img.shields.io/badge/-snapper%20%F0%9F%93%B7-%230DBC79?style=flat-square)](https://github.com/littletof/snapper)\n\n\n\u003e Snapper allows you to generate images from ANSI formatted text.\n\n\u003e 🚧 Project is WIP, expect breaking changes\n\nGenerate this image:\n![Example generated output](docs/images/all.png)\n\nWith this:\n```ts\nimport { snap } from \"https://deno.land/x/snapper@v0.0.6/mod.ts\";\n\nconst testText = `\u001b[1mbold            \u001b[22m\u001b[2mdim             \u001b[22m\u001b[3mitalic          \u001b[23m\u001b[4munderline       \u001b[24m\u001b[7minverse         \u001b[27m\u001b[9mstrikethrough   \u001b[29m \n\u001b[1m\u001b[30mblack           \u001b[39m\u001b[22m\u001b[1m\u001b[31mred             \u001b[39m\u001b[22m\u001b[1m\u001b[32mgreen           \u001b[39m\u001b[22m\u001b[1m\u001b[33myellow          \u001b[39m\u001b[22m\u001b[1m\u001b[34mblue            \u001b[39m\u001b[22m\u001b[1m\u001b[35mmagenta         \u001b[39m\u001b[22m\u001b[1m\u001b[36mcyan            \u001b[39m\u001b[22m\u001b[1m\u001b[37mwhite         \u001b[39m\u001b[22m\n\u001b[1m\u001b[90mgray            \u001b[39m\u001b[22m\u001b[30m\u001b[91mredBright       \u001b[30m\u001b[39m\u001b[30m\u001b[92mgreenBright     \u001b[30m\u001b[39m\u001b[30m\u001b[93myellowBright    \u001b[30m\u001b[39m\u001b[30m\u001b[94mblueBright      \u001b[30m\u001b[39m\u001b[30m\u001b[95mmagentaBright   \u001b[30m\u001b[39m\u001b[30m\u001b[96mcyanBright      \u001b[30m\u001b[39m\u001b[30m\u001b[97mwhiteBright  \u001b[30m\u001b[39m\n\u001b[37m\u001b[1m\u001b[40mbgBlack         \u001b[49m\u001b[22m\u001b[39m\u001b[30m\u001b[1m\u001b[41mbgRed           \u001b[49m\u001b[22m\u001b[39m\u001b[30m\u001b[1m\u001b[42mbgGreen         \u001b[49m\u001b[22m\u001b[39m\u001b[30m\u001b[1m\u001b[43mbgYellow        \u001b[49m\u001b[22m\u001b[39m\u001b[30m\u001b[1m\u001b[44mbgBlue          \u001b[49m\u001b[22m\u001b[39m\u001b[30m\u001b[1m\u001b[45mbgMagenta       \u001b[49m\u001b[22m\u001b[39m\u001b[30m\u001b[1m\u001b[46mbgCyan          \u001b[49m\u001b[22m\u001b[39m\u001b[30m\u001b[1m\u001b[47mbgWhite       \u001b[49m\u001b[22m\u001b[39m\n\u001b[37m\u001b[3m\u001b[100mbgBlackBright   \u001b[49m\u001b[23m\u001b[39m\u001b[30m\u001b[3m\u001b[101mbgRedBright     \u001b[49m\u001b[23m\u001b[39m\u001b[30m\u001b[3m\u001b[102mbgGreenBright   \u001b[49m\u001b[23m\u001b[39m\u001b[30m\u001b[3m\u001b[103mbgYellowBright  \u001b[49m\u001b[23m\u001b[39m\u001b[30m\u001b[3m\u001b[104mbgBlueBright    \u001b[49m\u001b[23m\u001b[39m\u001b[30m\u001b[3m\u001b[105mbgMagentaBright \u001b[49m\u001b[23m\u001b[39m\u001b[30m\u001b[3m\u001b[106mbgCyanBright    \u001b[49m\u001b[23m\u001b[39m\u001b[30m\u001b[3m\u001b[107mbgWhiteBright \u001b[49m\u001b[23m\u001b[39m`;\n\nawait snap([\n    {content: testText, imageSavePath: 'docs/images/all.png', viewport: {width: 1045}},\n]);\n```\n\n# Usage\n\n#### Set up puppeteer\n\u003e In the background the module uses [deno Puppeteer](https://deno.land/x/puppeteer@9.0.2), which is a fork of [Puppeteer](https://github.com/puppeteer/puppeteer).\n\nFollow the [current setup steps](https://github.com/lucacasonato/deno-puppeteer#installation), the basic setups should be something like:\n\n```bash\nPUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@9.0.2/install.ts\n\n#windows\n$env:PUPPETEER_PRODUCT='chrome'; deno run -A --unstable https://deno.land/x/puppeteer@9.0.2/install.ts\n```\n\n## Generate images\nAfter puppeteer was set up, simply run the following:\n\n```ts\nimport { snap } from \"https://deno.land/x/snapper@v0.0.6/mod.ts\";\n\nconst snapperText = `\\x1b[42m \\x1b[1m\\x1b[37mSnapper\\x1b[39m\\x1b[22m 📷  \\x1b[49m`;\n\nawait snap([\n    /* 1 */{content: snapperText, imageSavePath: 'snapper.png'},\n    /* 2 */{content: snapperText, imageSavePath: 'snapper_theme.png', theme: {background: '#acacac', green: '#297', brightWhite: '#ddd'}},\n    /* 3 */{content: snapperText, imageSavePath: 'snapper_font.png', fontFamily: \"fantasy\", fontSize: 10},\n    /* 4 */{content: snapperText, imageSavePath: 'snapper_padding.png', padding: '0px 0px 0px 0px', viewport: {width: 135}},\n    /* 5 */{content: snapperText, imageSavePath: 'snapper_viewport.png', viewport: {width: 135, height: 35, deviceScaleFactor: 1}},\n], { verbose: true, viewport: {width: 135}});\n```\n\nThe generated images will be placed placed into `cwd`+`imageSavePath`:\n|    |                                               |\n|----|-----------------------------------------------|\n| 1. | ![result](./docs/images/snapper.png)          |\n| 2. | ![result](./docs/images/snapper_theme.png)    |\n| 3. | ![result](./docs/images/snapper_font.png)     |\n| 4. | ![result](./docs/images/snapper_padding.png)  |\n| 5. | ![result](./docs/images/snapper_viewport.png) |\n\nWhen creating multiple images, provide your inputs to `snap` in bulk, otherwise, calling the function one-by-one will take a lot of time to finish.\n\n## Options\n See the [docs](https://doc.deno.land/https/deno.land/x/snapper@v0.0.6/mod.ts) and the example code above for the different options.\n\n\u003e `height` cuts the image, while a small `width` will result in the content wrapping\n\n## 🚩 Flags\n\n|Flag| Required |Reason|\n|:--|:-:|:--|\n| 🚧 `--unstable`  | yes | Needed for [Puppeteer](https://deno.land/x/puppeteer) |\n| 🧭 `--allow-env` | yes | Needed for [Puppeteer](https://deno.land/x/puppeteer) to access which browser to use |\n| 🔍 `--allow-read` | yes | Needed for [Puppeteer](https://deno.land/x/puppeteer) to read the browser executable |\n| 💾 `--allow-write` | yes | Needed for [Puppeteer](https://deno.land/x/puppeteer) to read the browser executable and to save the generated images |\n| ⚠ `--allow-run` | yes | Needed for [Puppeteer](https://deno.land/x/puppeteer) to run the browser in the background |\n| 🌐 `--allow-net` | yes | Needed to be able to run the background server which puppeteer visits and captures |\n\n# Spread the word\nIf you use `snapper` in your module or to generate images for your documentation/Readme consider adding a badge to it:\n\n[![snapper_deno](https://img.shields.io/badge/-snapper%20%F0%9F%93%B7-%230DBC79)](https://github.com/littletof/snapper)\n[![snapper_deno](https://img.shields.io/badge/-snapper%20%F0%9F%93%B7-%230DBC79?style=flat-square)](https://github.com/littletof/snapper)\n\n[![snapper_deno](https://img.shields.io/badge/-snapper%20%F0%9F%93%B7-black)](https://github.com/littletof/snapper)\n[![snapper_deno](https://img.shields.io/badge/-snapper%20%F0%9F%93%B7-black?style=flat-square)](https://github.com/littletof/snapper)\n\n[![snapper_deno](https://img.shields.io/badge/-%20snapper%20%F0%9F%93%B7-4E9A06)](https://github.com/littletof/snapper)\n[![snapper_deno](https://img.shields.io/badge/-%20snapper%20%F0%9F%93%B7-4E9A06?style=flat-square)](https://github.com/littletof/snapper)\n\n# TODO\n\n- [ ] Try polyfill DOM+canvas, use xterm without puppeteer\n- [ ] Improve server, so it can be hosted as a standalone site","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flittletof%2Fsnapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flittletof%2Fsnapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flittletof%2Fsnapper/lists"}