{"id":26045265,"url":"https://github.com/motetpaper/sealchop-js","last_synced_at":"2025-10-13T22:44:21.327Z","repository":{"id":280881567,"uuid":"943484032","full_name":"motetpaper/sealchop-js","owner":"motetpaper","description":"Chinese seal chop JavaScript module","archived":false,"fork":false,"pushed_at":"2025-04-11T04:48:07.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-13T22:44:20.630Z","etag":null,"topics":["chinese-seal-chop","javascript","javascript-library","javascript-module","stationery"],"latest_commit_sha":null,"homepage":"","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/motetpaper.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-05T19:26:41.000Z","updated_at":"2025-04-11T04:48:10.000Z","dependencies_parsed_at":"2025-03-05T20:43:46.748Z","dependency_job_id":"aa513bc1-150a-4bcc-b5a7-77de7360c13e","html_url":"https://github.com/motetpaper/sealchop-js","commit_stats":null,"previous_names":["motetpaper/sealchop-js"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/motetpaper/sealchop-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/motetpaper%2Fsealchop-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/motetpaper%2Fsealchop-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/motetpaper%2Fsealchop-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/motetpaper%2Fsealchop-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/motetpaper","download_url":"https://codeload.github.com/motetpaper/sealchop-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/motetpaper%2Fsealchop-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017142,"owners_count":26085984,"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":"2025-10-13T02:00:06.723Z","response_time":61,"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":["chinese-seal-chop","javascript","javascript-library","javascript-module","stationery"],"created_at":"2025-03-07T19:34:29.516Z","updated_at":"2025-10-13T22:44:21.286Z","avatar_url":"https://github.com/motetpaper.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e ## **NOTE:** This is the software object for developers. To create a seal chop design online, please use [the Chinese Korean Seal Chop Generator](https://motetpaper.github.io/chop/).\n\n# sealchop-js\n\n## Purpose\n\n**`sealchop-js`** is designed to create Chinese seal chops for display on web pages (and blogs) or for print on paper stationery (e.g., business cards, letterheads, envelopes, notebooks, etc.). \n\nThis is the web version, designed as a JavaScript module, as opposed to the other versions designed for GitHub Actions workflows or RESTful APIs.\n\n## Quick Start\n\nWe start with two files: `app.js` and `index.html`.\n\nHere is the directory structure:\n```bash\n├── app.js\n└── index.html\n```\n\n### `index.html`\n\nCopy and paste the following into your empty `index.html` file.\n\n```html\n\u003c!doctype html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"utf-8\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cdiv id=\"motet-sealchop\"\u003e\u003c/div\u003e\n\u003cscript type=\"module\" src=\"/app.js\"\u003e\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### `app.js`\n\nCopy and paste the following into your `app.js`. As you can see, a single line imports the object into the module. Now, you can start making Chinese seal chops.\n\n```javascript\nimport { SealChopObject } from 'https://motetpaper.github.io/sealchop-js/SealChopObject.js'\n\nconst chop = new SealChopObject();\nconst img = chop.setName('姓名字').asImageElement();\ndocument.querySelector('#motet-sealchop').innerHTML = img;\n```\n\nThat was easy.\n\nNow, let us start a local web server to see this in action.\n\nIn the same directory as `index.html`, start a localhost web server with a [secure context][sec].\n\nFor example:\n```bash\nphp -S localhost:8888\n```\n\n[sec]: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts\n\n\n## SYNPOSIS\n\n\n### `constructor()`\n\nConstructs a new chop object. Returns this object.\n\n```javascript\nconst chop = new SealChopObject();\n```\n\n### `.toJSON()`\n\nReturns a JSON string.\n\n```javascript\nconst json = chop.toJSON();\n\n// output\n{\n  \"p\": \"#ffffff\",\n  \"b\": \"#33aa55\",\n  \"f\": \"#ffffff\",\n  \"i\": \"#003300\",\n  \"x\": \"姓名字\"\n}\n```\n\n### `.toString()`\n\nSame as `.toJSON()`.\n\n```javascript\nconst str = chop.toString();\nconst str = '' + chop;\n```\n\n### `.toDataURL()`\n\nReturns a base64 data string.\n\n```javascript\n// set the name, then get the base64 url\nconst img = new Image();\nconst url = chop.setName('姓名字').toDataURL();\nimg.src = url;\n```\n\n### `.asImageElement()`\n\nReturns an HTML Image element with a chop in it.\n\n```javascript\nconst chop = new SealChopObject();\nconst img = chop.setName('姓名字').asImageElement();\ndocument.querySelector('#motet-sealchop').innerHTML = img;\n```\n\n### `.setName(string)`\n\nSet `name` with a valid Chinese characters (1, 2, 3 or 4 characters). All other characters are removed. If no characters remain, it is set to `null`. Also, returns this object.\n\n### `.setPaperColor(string)`\n\nSets `paper` color with a valid 6-digit hex color (e.g., `#ffffff`). Otherwise, sets it to `null`. Also, returns this object.\n\n### `.setBackgroundColor(string)`\n\nSets `background` color with a valid 6-digit hex color (e.g., `#ffffff`). Otherwise, sets it to `null`. Also, returns this object.\n\n\n### `.setForegroundColor(string)`\n\nSets `foreground` color with a valid 6-digit hex color (e.g., `#ffffff`). Otherwise, sets it to `null`. Also, returns this object.\n\n\n### `.setInkColor(string)`\n\nSets `ink` color with a valid 6-digit hex color (e.g., `#ffffff`). Otherwise, sets it to `null`. Also, returns this object.\n\n\n## Deprecated methods\n\n\u003e **NOTE:** These methods will be removed soon.\n\n### `.setXingMing(string)`\n\nSame as `.setName()`. This method will be removed soon.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmotetpaper%2Fsealchop-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmotetpaper%2Fsealchop-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmotetpaper%2Fsealchop-js/lists"}