{"id":18070286,"url":"https://github.com/imsyy/color-utils","last_synced_at":"2026-01-02T01:08:24.803Z","repository":{"id":244357368,"uuid":"815000731","full_name":"imsyy/color-utils","owner":"imsyy","description":"A library of easy-to-use image tools","archived":false,"fork":false,"pushed_at":"2024-07-11T08:05:58.000Z","size":63,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-05T00:04:34.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/imsyy.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}},"created_at":"2024-06-14T06:27:35.000Z","updated_at":"2024-08-29T11:10:41.000Z","dependencies_parsed_at":"2024-06-14T08:27:05.041Z","dependency_job_id":"f765a348-d62c-4904-9bfc-7cf063518906","html_url":"https://github.com/imsyy/color-utils","commit_stats":null,"previous_names":["imsyy/color-utils"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsyy%2Fcolor-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsyy%2Fcolor-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsyy%2Fcolor-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsyy%2Fcolor-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imsyy","download_url":"https://codeload.github.com/imsyy/color-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243365640,"owners_count":20279215,"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-31T08:24:43.450Z","updated_at":"2026-01-02T01:08:24.754Z","avatar_url":"https://github.com/imsyy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# color-utils\n\nSome common color processing tools, color format conversion, image processing, etc.\n\n## Install\n\n```bash\nnpm install @imsyy/color-utils\n```\n\n## Usage\n\n### Conversion\n\n| Method Name | Parameters                                            | Description                          |\n| ----------- | ----------------------------------------------------- | ------------------------------------ |\n| `rgbToHsv`  | (r: number, g: number, b: number)                     | Converts RGB values to HSV.          |\n| `rgbToHex`  | (r: number, g: number, b: number)                     | Converts RGB values to HEX format.   |\n| `rgbToHev`  | (r: number, g: number, b: number)                     | Converts RGB values to HEV format.   |\n| `rgbToCmyk` | (r: number, g: number, b: number)                     | Converts RGB values to CMYK format.  |\n| `rgbToHwb`  | (r: number, g: number, b: number)                     | Converts RGB values to HWB format.   |\n| `hexToRgb`  | (hex: string)                                         | Converts a HEX string to RGB values. |\n| `hsvToRgb`  | (h: number, s: number, v: number)                     | Converts HSV values to RGB format.   |\n| `hslToRgb`  | (h: number, s: number, l: number)                     | Converts HSL values to RGB format.   |\n| `cmykToRgb` | (c: number, m: number, y: number, k: number)          | Converts CMYK values to RGB format.  |\n| `hwbToRgb`  | (h: number, w: string \\| number, b: string \\| number) | Converts HWB values to RGB format.   |\n\n**for example:**\n\n```ts\n// rgbToHsv\nimport { rgbToHsv } from \"color-utils\";\n\nrgbToHsv(255, 0, 0); // { \"h\": 0, \"s\": 100, \"v\": 100 }\n```\n\n### Processing\n\n| Method Name             | Parameters                                        | Description                                      |\n| ----------------------- | ------------------------------------------------- | ------------------------------------------------ |\n| `getRandomColor`        | ()                                                | Generates a random color in RGB format.          |\n| `adjustBrightness`      | (r: number, g: number, b: number, factor: number) | Adjusts the brightness of an RGB color.          |\n| `getColorDifference`    | (color1: string, color2: string)                  | Calculates the difference between two colors.    |\n| `getComplementaryColor` | (color: string)                                   | Gets the complementary color of the given color. |\n\n**for example:**\n\n```ts\n// getColorDifference\nimport { getColorDifference } from \"color-utils\";\n\ngetColorDifference(\"#ffffff\", \"#000000\"); // 441.6729559300637\n```\n\n### Recognition\n\n| Method Name     | Parameters                                             | Description                                                      |\n| --------------- | ------------------------------------------------------ | ---------------------------------------------------------------- |\n| `getImageColor` | (img: string \\| HTMLImageElement, quality: number = 5) | Extracts the dominant colors from an image.                      |\n| `getMDColor`    | (color: string, option: { type: \"rgb\" })               | Generates a Material Design color scheme based on a given color. |\n\n**for example:**\n\n```ts\n// getMDColor\nimport { getMDColor } from \"color-utils\";\n\ngetMDColor(\"#123456\");\n\n// Generate\n{\n    \"light\": {\n        // ...,\n    },\n    \"dark\": {\n        // ...,\n    }\n}\n```\n\n## Testing\n\n```bash\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimsyy%2Fcolor-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimsyy%2Fcolor-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimsyy%2Fcolor-utils/lists"}