{"id":15651797,"url":"https://github.com/ph1p/vue-paintable","last_synced_at":"2025-07-03T01:38:32.060Z","repository":{"id":32458181,"uuid":"130201150","full_name":"ph1p/vue-paintable","owner":"ph1p","description":"With this vue component you can add a paintable canvas through every page you like.","archived":false,"fork":false,"pushed_at":"2023-01-06T18:16:19.000Z","size":3579,"stargazers_count":32,"open_issues_count":21,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-23T15:09:11.060Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://paintable-vue.vercel.app/","language":"Vue","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/ph1p.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}},"created_at":"2018-04-19T10:46:29.000Z","updated_at":"2024-05-05T07:33:57.000Z","dependencies_parsed_at":"2023-01-14T21:16:52.942Z","dependency_job_id":null,"html_url":"https://github.com/ph1p/vue-paintable","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"purl":"pkg:github/ph1p/vue-paintable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ph1p%2Fvue-paintable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ph1p%2Fvue-paintable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ph1p%2Fvue-paintable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ph1p%2Fvue-paintable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ph1p","download_url":"https://codeload.github.com/ph1p/vue-paintable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ph1p%2Fvue-paintable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263244843,"owners_count":23436480,"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":[],"created_at":"2024-10-03T12:40:12.184Z","updated_at":"2025-07-03T01:38:32.028Z","avatar_url":"https://github.com/ph1p.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-paintable [![npm](https://badge.fury.io/js/vue-paintable.svg)](https://www.npmjs.com/package/vue-paintable) [![](https://img.shields.io/badge/vercel-demo-black.svg)](https://vue-paintable.vercel.app/)\n\nWith this vue plugin and component you can add a paintable canvas through your page.\nAll paintings are saved by default into localStorage.\n\n\n\u003cp align=\"center\"\u003e\n  \u003ca target=\"_blank\" href=\"https://vue-paintable.vercel.app\"\u003e\n    \u003cimg src=\"./demo.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n### How to use?\n\n```bash\nnpm install vue-paintable\n```\n\nor\n\n```bash\nyarn add vue-paintable\n```\n\nInside your main (typically main.js)\n\n```javascript\nimport Vue from 'vue';\nimport Paintable from 'vue-paintable';\n\nVue.use(Paintable, {\n  // optional methods\n  setItem(key, image) {\n    localStorage.setItem(key, image);\n  },\n  // you also can use async\n  getItem(key) {\n    return localStorage.getItem(key);\n  },\n  removeItem(key) {\n    localStorage.removeItem(key);\n  }\n});\n//...\n```\n\n#### Inside your components\n\n```html\n\u003ctemplate\u003e\n  \u003cpaintable\n    alwaysOnTop\n    :active=\"isActive\"\n    :width=\"800\"\n    :height=\"800\"\n    :disableNavigation=\"disableNavigation\"\n    :hide=\"hidePaintable\"\n    :horizontalNavigation=\"true\"\n    :navigation=\"navigation\"\n    :name=\"isFirstPaintable ? 'my-screen' : 'my-second-screen'\"\n    :factor=\"1\"\n    :lineWidth=\"dynamicLineWidth\"\n    :lineWidthEraser=\"20\"\n    :useEraser=\"useEraser\"\n    :color=\"color\"\n    class=\"paint\"\n    ref=\"paintable\"\n    @toggle-paintable=\"toggledPaintable\"\n  \u003e\n    Your content\n    \u003crouter-view\u003e\u003c/router-view\u003e\n  \u003c/paintable\u003e\n\u003c/template\u003e\n```\n\n### Navigation\n\nSet your own navigation content by adding an object to your `\u003cpaintable\u003e` component.\n\n```javascript\n{\n  'draw-save': {\n    body: 'draw',\n    activeBody: '\u003cstrong\u003esave\u003c/strong\u003e'\n  },\n  color: {\n    body: 'CP'\n  }\n}\n```\n\n**Display navigation horizontal**\n\nTo display the navigation horizontally add `horizontalNavigation` to prop list.\n\n**Available navigation items:**\n\n- color\n- line-width\n- undo\n- redo\n- delete\n- cancel\n\n**has active state (activeBody):**\n\n- draw-save\n- eraser-pencil\n\n### Custom Navigation\n\nTo use a custom navigation disable the default navigation with `disableNavigation`.\n\n#### use \\$refs to call paintable methods\n\n```html\n\u003cpaintable ref=\"paintable\"\u003econtent\u003c/paintable\u003e\n\n\u003cbutton @click=\"$refs.paintable.undoDrawingStep\"\u003eundo\u003c/button\u003e\n\u003cbutton @click=\"$refs.paintable.redoDrawingStep\"\u003eredo\u003c/button\u003e\n\u003cbutton @click=\"$refs.paintable.clearCanvas\"\u003eclear\u003c/button\u003e\n\u003cbutton @click=\"$refs.paintable.saveCurrentCanvasToStorage\"\u003e\n  save\n\u003c/button\u003e\n\u003cbutton @click=\"$refs.paintable.cancelDrawing\"\u003ecancel\u003c/button\u003e\n```\n\nTake a look at the [demo](https://vue-paintable.vercel.app/) (`/src/App.vue`)\n\n\n### Props\n\n| name                 | type                            | required | default                                                                  | description                                                    |\n| -------------------- | ------------------------------- | -------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------|\n| name                 | string - required               | true     | -                                                                        | unique identifier                                              |\n| showUndoRedo         | boolean                         | false    | true                                                                     | show undo and redo button                                      |\n| hide                 | boolean                         | false    | false                                                                    | hide the complete paintable                                    |\n| colors               | Array of colors (rgb, hex etc.) | false    | ['black', '#f00', '#4481c7', 'rgba(255, 235, 59, 0.4)', '#999', 'green'] | array of choosable colors                                      |\n| width                | number                          | false    | window.innerWidth                                                        | canvas width                                                   |\n| height               | number                          | false    | window.innerHeight                                                       | canvas height                                                  |\n| showLineWidth        | boolean                         | false    | true                                                                     | show button to set line width                                  |\n| lineWidth            | number                          | false    | 5                                                                        | line width                                                     |\n| alwaysOnTop          | boolean                         | false    | true                                                                     | set canvas always as top layer                                 |\n| factor               | number                          | false    | 1                                                                        | set a scale factor if needed                                   |\n| lineWidthEraser      | number                          | false    | 20                                                                       | set eraser line width                                          |\n| horizontalNavigation | boolean                         | false    | true                                                                     | display the navigation horizontally or vertically              |\n| disableNavigation    | boolean                         | false    | false                                                                    | hide navigation                                                |\n| active               | boolean                         | false    | false                                                                    | set paintable active/inactive                                  |\n| color                | string                          | false    | #000                                                                     | current color                                                  |\n| useEraser            | boolean                         | false    | false                                                                    | set to true, to use the eraser                                 |\n| threshold            | number                          | false    | 0                                                                        | set the threshold on which an event gets triggered (see events)|\n\n### Events\n\n| name             | type    | description                                          |\n| ---------------- | ------- | ---------------------------------------------------- |\n| toggle-paintable | boolean | Is emitted, when changing paintable state            |\n| thresholdReached | boolean | Is emitted, when the speciefied threshold is reached |\n\n```html\n\u003cpaintable @toggle-paintable=\"toggledPaintable\"\u003e\u003c/paintable\u003e\n\n\u003cpaintable :threshold=\"10\" @thresholdReached=\"thresholdReached\"\u003e\u003c/paintable\u003e\n```\n\n### development\n\nIf you want to develop with this plugin, follow these steps:\n\n- clone repo\n- run `yarn install` or `npm install`\n- run `yarn serve` or `npm run serve`\n\n### build\n\nYou can find all built files inside the `dist` folder.\n\n- run `yarn build` or `npm run build`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fph1p%2Fvue-paintable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fph1p%2Fvue-paintable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fph1p%2Fvue-paintable/lists"}