{"id":16610996,"url":"https://github.com/material-extensions/svg-color-linter","last_synced_at":"2025-03-21T14:31:01.959Z","repository":{"id":43348674,"uuid":"466560161","full_name":"material-extensions/svg-color-linter","owner":"material-extensions","description":"Linter for checking SVG color palette","archived":false,"fork":false,"pushed_at":"2025-01-11T15:55:39.000Z","size":460,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T07:09:21.774Z","etag":null,"topics":["color-palette","colors","svg"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/svg-color-linter","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/material-extensions.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":["pkief"],"custom":["https://paypal.me/philippkief","https://buymeacoffee.com/pkief"]}},"created_at":"2022-03-05T20:24:51.000Z","updated_at":"2025-02-09T11:54:06.000Z","dependencies_parsed_at":"2023-11-12T12:22:56.701Z","dependency_job_id":"1febbb4e-b9bb-4c8e-8ebb-b3a10d8fa43a","html_url":"https://github.com/material-extensions/svg-color-linter","commit_stats":{"total_commits":45,"total_committers":3,"mean_commits":15.0,"dds":0.1777777777777778,"last_synced_commit":"83e9e639b32992004f28e49c425967f2907ac5da"},"previous_names":["material-extensions/svg-color-linter"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/material-extensions%2Fsvg-color-linter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/material-extensions%2Fsvg-color-linter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/material-extensions%2Fsvg-color-linter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/material-extensions%2Fsvg-color-linter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/material-extensions","download_url":"https://codeload.github.com/material-extensions/svg-color-linter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244815110,"owners_count":20514892,"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":["color-palette","colors","svg"],"created_at":"2024-10-12T01:34:18.045Z","updated_at":"2025-03-21T14:31:01.953Z","avatar_url":"https://github.com/material-extensions.png","language":"TypeScript","funding_links":["https://github.com/sponsors/pkief","https://paypal.me/philippkief","https://buymeacoffee.com/pkief"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cbr\u003e\n    \u003cimg src=\"https://github.com/material-extensions/svg-color-linter/raw/main/logo.png\" alt=\"logo\" width=\"200\"\u003e\n  \u003cbr\u003e\u003cbr\u003e\n  SVG Color Linter\n  \u003cbr\u003e\n  \u003cbr\u003e\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003eLinting tool to check if SVG files only use colors of a given color palette.\u003c/h4\u003e\n\n## CLI Command\n\nThe tool can be executed with this command:\n\n```\nbunx svg-color-linter --config color-config.yml file1.svg file2.svg\n```\n\nIt will fetch all the colors of a YAML file which must have the following structure:\n\n```yaml\ncolors:\n  - \"#FFEBEE\"\n  - \"#FFCDD2\"\n  - \"#EF9A9A\"\n  - \"#E57373\"\n  - \"#EF5350\"\n  - \"#F44336\"\n```\n\nIt also supports glob file patterns to check multiple files matching the pattern like this:\n\n```\nbunx svg-color-linter --config color-config.yml ./images/**/*.svg ./another-dir/*.svg test.svg\n```\n\n### Excluding Files\n\nYou can exclude specific files or patterns from the analysis by adding an `exclude` key in the `color-config.yml` file. The `exclude` key should contain a list of file patterns to be ignored. For example:\n\n```yaml\ncolors:\n  - \"#FFEBEE\"\n  - \"#FFCDD2\"\n  - \"#EF9A9A\"\n  - \"#E57373\"\n  - \"#EF5350\"\n  - \"#F44336\"\n\nexclude:\n  - \"icons/icon1.svg\"\n  - \"icons/icon2.svg\"\n  - ...\n```\n\n## Programmatic use\n\nThe tool can be imported as module into existing JavaScript or TypeScript code. Therefor it is necessary to install it via package manager:\n\n```\nnpm install svg-color-linter\n```\n\nThe module can be imported like this:\n\n```ts\nimport { isColorInPalette, getSuggestions } from 'svg-color-linter';\n\nisColorInPalette('#FFFFFF', ['#EEEEEE', '#121212']);\n// false\n\ngetSuggestions('#C0CA35', ['#EEEEEE', '#121212']);\n// [\n//   { hex: '#C0CA33', distance: 0.160467661071053 },\n//   { hex: '#CDDC39', distance: 4.307076277707079 },\n//   { hex: '#D4E157', distance: 5.606714639567858 },\n//   { hex: '#AFB42B', distance: 5.713845679863578 },\n//   { hex: '#DCE775', distance: 8.065940911169271 }\n// ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaterial-extensions%2Fsvg-color-linter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaterial-extensions%2Fsvg-color-linter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaterial-extensions%2Fsvg-color-linter/lists"}