{"id":50588162,"url":"https://github.com/iolo/redraw","last_synced_at":"2026-06-05T08:01:29.016Z","repository":{"id":357156074,"uuid":"1235206918","full_name":"iolo/redraw","owner":"iolo","description":"Lightweight MSPaint-style drawing for React.","archived":false,"fork":false,"pushed_at":"2026-05-11T15:10:30.000Z","size":195,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-11T16:31:19.678Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://iolo.kr/redraw/","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/iolo.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-11T05:36:22.000Z","updated_at":"2026-05-11T15:22:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/iolo/redraw","commit_stats":null,"previous_names":["iolo/redraw"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/iolo/redraw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fredraw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fredraw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fredraw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fredraw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iolo","download_url":"https://codeload.github.com/iolo/redraw/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fredraw/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33935514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"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":[],"created_at":"2026-06-05T08:01:26.980Z","updated_at":"2026-06-05T08:01:28.984Z","avatar_url":"https://github.com/iolo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redraw\n\nRedraw is an MSPaint-like drawing component for React. It provides a simple interface for drawing on a canvas, and it supports loading and saving the drawing as a data URL.\n\n[![Drawing Hands by M. C. Escher](DrawingHands.jpg)](https://mcescher.com/gallery/back-in-holland/#iLightbox[gallery_image_1]/31)\n\n## Getting Started\n\nInstall dependency:\n```console\n$ npm install @iolo/redraw\n```\n\nImport and use the component:\n```jsx\nimport { Redraw } from '@iolo/redraw';\n\nfunction App() {\n  return (\u003cRedraw onChange={(dataUrl) =\u003e console.log(dataUrl)} /\u003e);\n}\n```\n\nThat's it! You can now draw on the canvas and save your drawing as a data URL.\n\nYou can use `useRef` to get the reference of the Redraw component and call its methods to manipulate the drawing\nprogrammatically.\n\n```jsx\nimport { useRef } from 'react';\nimport { Redraw, RedrawRef, loadImage, saveImage } from '@iolo/redraw';\nfunction App() {\n  const redrawRef = useRef\u003cRedrawRef\u003e(null);\n\n  const handleSave = () =\u003e {\n    if (redrawRef.current) {\n      const dataUrl = redrawRef.current.getDataUrl(); // get the drawing as data URL\n      saveImage(dataUrl, 'drawing.png'); // download(save on local) the image as file\n    }\n  };\n\n  const handleOpen = async (event) =\u003e {\n    const file = event.target.files[0];\n    const dataUrl = await loadImage(file); // load the image file as data URL\n    redrawRef.current?.setDataUrl(dataUrl); // load the data URL into Redraw\n  };\n\n  return (\n    \u003c\u003e\n      \u003cRedraw\n        ref={redrawRef}\n        width={500}\n        height={500}\n        tool=\"pen\"\n        strokeColor=\"#000000\"\n        strokeWidth={2}\n        fillColor=\"#ff0000\"\n        backgroundColor=\"#ffffff\"\n        dataUrl=\"\" // initial data URL\n      /\u003e\n      \u003cbutton onClick={handleSave}\u003eSave\u003c/button\u003e\n      \u003cinput type=\"file\" id=\"fileInput\" onChange={handleOpen} /\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n## Features\n\n- Pen, Spray, Eraser, Spoid(Picker), Fill, Line, Rectangle, Circle(Ellipse) tools\n- Paint-style layout: tools at top-left, controls below tools, drawing area on the right, colors at bottom-left, and palette at bottom-right\n- SVG-based tool and action icons styled with CSS\n- Stroke width control\n- Shared 32-color palette for stroke and fill\n- Current stroke/fill previews with swap action\n- Custom color dialog with RGBA sliders and HEX input\n- Background color property support\n- Undo/Redo\n- Load/Save drawing as data URL\n- Utilities for manipulating/loading/saving images\n\n## Tech Stack\n\n### Frontend\n\n- [typescript](https://www.typescriptlang.org/)\n- [react](https://reactjs.org/) - UI library\n\n\n### Testing\n\n- [vitest](https://vitest.dev/) - Unit testing\n- [playwright](https://playwright.dev/) - E2E testing\n\n### Build\n\n- [vite](https://vitejs.dev/)\n\n## Guidelines\n\n- Keep it simple and minimal.\n\n---\n\nMay the **SOURCE** be with you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiolo%2Fredraw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiolo%2Fredraw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiolo%2Fredraw/lists"}