{"id":25943450,"url":"https://github.com/tobitsoftware/chayns-colors","last_synced_at":"2025-06-30T00:03:14.250Z","repository":{"id":57101351,"uuid":"295405914","full_name":"TobitSoftware/chayns-colors","owner":"TobitSoftware","description":"JavaScript utility functions for the calculation of colors for chayns","archived":false,"fork":false,"pushed_at":"2021-09-23T08:58:03.000Z","size":1154,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-30T00:02:30.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/TobitSoftware.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":"2020-09-14T12:15:11.000Z","updated_at":"2021-09-23T08:57:42.000Z","dependencies_parsed_at":"2022-08-20T21:10:54.395Z","dependency_job_id":null,"html_url":"https://github.com/TobitSoftware/chayns-colors","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/TobitSoftware/chayns-colors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobitSoftware%2Fchayns-colors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobitSoftware%2Fchayns-colors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobitSoftware%2Fchayns-colors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobitSoftware%2Fchayns-colors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TobitSoftware","download_url":"https://codeload.github.com/TobitSoftware/chayns-colors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TobitSoftware%2Fchayns-colors/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262685618,"owners_count":23348447,"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":"2025-03-04T07:16:43.453Z","updated_at":"2025-06-30T00:03:14.195Z","avatar_url":"https://github.com/TobitSoftware.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @chayns/colors\nJavaScript utility functions for the calculation of colors for chayns\n\n## Usage\n\n### Installation\nThis package can be installed from npm using ``npm install @chayns/colors``.\n\n### Color Model Value Ranges\n\n#### [RGB (Red - Green - Blue)](https://en.wikipedia.org/wiki/RGB_color_model)\nHEX\n- Three (four with transparency) components of each two hexadecimal characters, starting with a ``#``.\n- Example: #00ff3d (chayns blue)\n\nRGB255\n- r, g, b: 0 - 255\n- a (transparency, optional): 0 - 1\n\nRGB1\n- r, g, b: 0 - 1\n- a (transparency, optional): 0 - 1\n\n#### [HSL and HSV](https://en.wikipedia.org/wiki/HSL_and_HSV)\nHSL (Hue - Saturation - Lightness)\n- h: 0 - 360\n- s, l: 0 - 1\n- a (transparency, optional): 0 - 1\n\nHSV (Hue - Saturation - Value)\n- h: 0 - 360\n- s, v: 0 - 1\n- a (transparency, optional): 0 - 1\n\n### Available Functions\nThis package provides general functions to convert colors from one color model into another as well as chayns-specific functions for generating chayns colors.\nAll functions allow the usage of colors with a transparency. You just have to add ``a`` to your color (fourth hexadecimal pair for HEX color).\n\nYou can import the functions like this: ``import { isHex } from @chayns/colors;``.\n\nColor model conversion functions:\n- rgb1ToRgb255(rgb1)\n- rgb1ToHex(rgb1)\n- rgb1ToHsl(rgb1)\n- rgb1ToHsv(rgb1)\n- rgb255ToRgb1(rgb255)\n- rgb255ToHex(rgb255)\n- rgb255ToHsl(rgb255)\n- rgb255ToHsv(rgb255)\n- hexToRgb1(hex)\n- hexToRgb255(hex)\n- hexToHsl(hex)\n- hexToHsv(hex)\n- hslToRgb1(hsl)\n- hslToRgb255(hsl)\n- hslToHex(hsl)\n- hslToHsv(hsl)\n- hsvToRgb1(hsv)\n- hsvToRgb255(hsv)\n- hsvToHex(hsv)\n- hsvToHsl(hsv)\n\nFunctions for normalizing and generating color strings:\n- normalizeHexString(hex)\n- normalizeRgbString(rgbString)\n- getRgb255String(rgb255)\n\nMixing functions:\n- mixHsv(color1, color2, weight)\n- mixHsl(color1, color2, weight)\n- mixRgb(color1, color2, weight)\n- mixHex(color1, color2, weight)\n\nLightening/darkening functions:\n- lightenHslColor(color, percent)\n- lightenHexColor(color, percent)\n- lightenHsvColor(color, percent)\n- lightenRgb255Color(color, percent)\n- darkenHexColor(color, percent)\n- darkenHslColor(color, percent)\n- darkenHsvColor(color, percent)\n- darkenRgb255Color(color, percent)\n\nType check functions:\n- isHex(value)\n- isRgbString(value)\n- isRgb255(value)\n- isRgb1(value)\n- isHsl(value)\n- isHsv(value)\n\nChayns-specific functions\n- getColorFromPalette(colorId, options)\n    - options is an object of color, colorMode and secondaryColor\n- getAvailableColorList()\n\n## Releases\n[Releasenotes](https://github.com/TobitSoftware/chayns-colors/releases) will be send and published via GitHub. To subscribe them, you just have to watch this repository.\n\n## Development\n1. Clone git repository\n2. Install npm packages\n3. Link with ``npm start``\n4. Run tests with ``npm test``\n   \n### Publishing\nIncrease version with ``npm version patch`` or ``npm version minor`` and push the commit and version tag. The npm package will be published via GitHub Actions.\n\n### Troubleshooting\nIf you get the error ``SyntaxError: Unexpected token {``, you have to update your node version to at least Node 10.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobitsoftware%2Fchayns-colors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobitsoftware%2Fchayns-colors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobitsoftware%2Fchayns-colors/lists"}