{"id":15388255,"url":"https://github.com/georapbox/eye-dropper-element","last_synced_at":"2025-08-17T01:06:02.650Z","repository":{"id":57749700,"uuid":"524058829","full_name":"georapbox/eye-dropper-element","owner":"georapbox","description":"A custom element that implements the EyeDropper API that allows the user to select colors from the screen.","archived":false,"fork":false,"pushed_at":"2025-03-17T07:22:53.000Z","size":465,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-08T16:51:14.513Z","etag":null,"topics":["custom-elements","web-components"],"latest_commit_sha":null,"homepage":"https://georapbox.github.io/eye-dropper-element/","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/georapbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2022-08-12T11:14:40.000Z","updated_at":"2025-03-17T07:22:57.000Z","dependencies_parsed_at":"2025-04-15T18:39:16.467Z","dependency_job_id":"ce0fcdd4-2f69-4bac-95d5-f6b4040f1cea","html_url":"https://github.com/georapbox/eye-dropper-element","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"73e1332d4145c00601b7b9ee15bddd057c1489c9"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/georapbox/eye-dropper-element","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georapbox%2Feye-dropper-element","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georapbox%2Feye-dropper-element/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georapbox%2Feye-dropper-element/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georapbox%2Feye-dropper-element/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/georapbox","download_url":"https://codeload.github.com/georapbox/eye-dropper-element/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georapbox%2Feye-dropper-element/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270791768,"owners_count":24645824,"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-08-16T02:00:11.002Z","response_time":91,"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":["custom-elements","web-components"],"created_at":"2024-10-01T14:56:09.603Z","updated_at":"2025-08-17T01:06:02.600Z","avatar_url":"https://github.com/georapbox.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://img.shields.io/npm/v/@georapbox/eye-dropper-element.svg)](https://www.npmjs.com/package/@georapbox/eye-dropper-element)\n[![npm license](https://img.shields.io/npm/l/@georapbox/eye-dropper-element.svg)](https://www.npmjs.com/package/@georapbox/eye-dropper-element)\n\n[demo]: https://georapbox.github.io/eye-dropper-element/\n[license]: https://github.com/georapbox/eye-dropper-element/blob/main/LICENSE\n[changelog]: https://github.com/georapbox/eye-dropper-element/blob/main/CHANGELOG.md\n\n# \u0026lt;eye-dropper\u0026gt;\n\nA custom element that implements the [EyeDropper API](https://developer.mozilla.org/docs/Web/API/EyeDropper) that allows the user to select colors from the screen.\n\n\u003e [!IMPORTANT]\n\u003e The EyeDropper API is still experimental and supported only on desktop Chromium based browsers. In not supported browsers, the color picker button will dispatch an event `eye-dropper:error` with an error message when clicked. You can check if the API is supported by using the a simple check like `'EyeDropper' in window` to decide whether to show the color picker button or handle the error event.\n\n[API documentation](#api) \u0026bull; [Demo][demo]\n\n## Install\n\n```sh\nnpm install --save @georapbox/eye-dropper-element\n```\n\n## Usage\n\n### Script\n\n```js\nimport { EyeDropperElement } from './node_modules/@georapbox/eye-dropper-element/dist/eye-dropper.js';\n\n// Manually define the element.\nEyeDropperElement.defineCustomElement();\n```\n\nAlternatively, you can import the automatically defined custom element.\n\n```js\nimport './node_modules/@georapbox/eye-dropper-element/dist/eye-dropper-defined.js';\n```\n\n### Markup\n\n```html\n\u003ceye-dropper\u003e\u003c/eye-dropper\u003e\n```\n\n### Style\n\nBy default, the component is style-free to remain as less opinionated as possible. However, you can style the various elements of the component using [CSS Parts](#css-parts) provided for this purpose.\n\n## API\n\n### Properties\n| Name | Reflects | Type | Required | Default | Description |\n| ---- | -------- | ---- | -------- | ------- | ----------- |\n| `disabled` | ✓ | Boolean | - | `false` | Whether the color picker button is disabled. |\n| `copy` | ✓ | Boolean | - | `false` | Whether the picked color should be copied to clipboard. |\n\n### Slots\n\n| Name | Description |\n| ---- | ----------- |\n| `button` | The slot for the button element. Example: `\u003ca href=\"#\" slot=\"button\" role=\"button\"\u003ePick a color\u003c/a\u003e` |\n| `button-label` | The slot for the button label. Example: `\u003cspan slot=\"button-label\"\u003ePick a color\u003c/span\u003e` |\n\n### CSS Parts\n\n| Name | Description |\n| ---- | ----------- |\n| `button` | The color picker button. |\n| `button--disabled` | The color picker button when is disabled. |\n\n### Methods\n\n| Name | Type | Description | Arguments |\n| ---- | ---- | ----------- | --------- |\n| `defineCustomElement` | Static | Defines/registers the custom element with the name provided. If no name is provided, the default name is used. The method checks if the element is already defined, hence will skip trying to redefine it. | `elementName='eye-dropper'` |\n\n### Events\n\n| Name | Description | Event Detail |\n| ---- | ----------- | ------------ |\n| `eye-dropper:success` | Emitted when color pick is successful. | `{ result: { sRGBHex: string }, colors: string[] }` |\n| `eye-dropper:abort` | Emitted when color pick is aborted. | - |\n| `eye-dropper:error` | Emitted if color pick fails for any reason. | `{ error: Error \\| TypeError }` |\n| `eye-dropper:copy` | Emitted if `copy` property is `true` and the picked color is successfully copied to clipbaord. | `{ value: string }` |\n\n## Changelog\n\nFor API updates and breaking changes, check the [CHANGELOG][changelog].\n\n## Development setup\n\n### Prerequisites\n\nThe project requires `Node.js` and `npm` to be installed on your environment. Preferrably, use [nvm](https://github.com/nvm-sh/nvm) Node Version Manager and use the version of Node.js specified in the `.nvmrc` file by running `nvm use`.\n\n### Install dependencies\n\nInstall the project dependencies by running the following command.\n\n```sh\nnpm install\n```\n\n### Build for development\n\nWatch for changes and start a development server by running the following command.\n\n```sh\nnpm start\n```\n\n### Linting\n\nLint the code by running the following command.\n\n```sh\nnpm run lint\n```\n\n### Testing\n\nRun the tests by running any of the following commands.\n\n```sh\nnpm test\nnpm run test:watch # watch mode\n```\n\n### Build for production\n\nCreate a production build by running the following command.\n\n```sh\nnpm run build\n```\n\n## License\n\n[The MIT License (MIT)][license]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorapbox%2Feye-dropper-element","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorapbox%2Feye-dropper-element","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorapbox%2Feye-dropper-element/lists"}