{"id":21331149,"url":"https://github.com/netbeast/colorsys","last_synced_at":"2025-04-24T00:23:08.033Z","repository":{"id":3977413,"uuid":"51578406","full_name":"netbeast/colorsys","owner":"netbeast","description":":art: Minimalistic color converter for RGB, HSV, HSL, CMYK, HEX and CSS strings","archived":false,"fork":false,"pushed_at":"2023-04-17T01:20:52.000Z","size":891,"stargazers_count":57,"open_issues_count":14,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-22T09:04:51.683Z","etag":null,"topics":["cmyk","color","css-string","hex","hsv","javascript","library","npm","random","rgb"],"latest_commit_sha":null,"homepage":"http://getyeti.co","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/netbeast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-02-12T09:38:08.000Z","updated_at":"2023-10-17T08:46:25.000Z","dependencies_parsed_at":"2023-07-06T07:34:23.550Z","dependency_job_id":null,"html_url":"https://github.com/netbeast/colorsys","commit_stats":{"total_commits":75,"total_committers":12,"mean_commits":6.25,"dds":"0.42666666666666664","last_synced_commit":"b5b365e1fb037a179e10ed14adfd1b247a2b6de5"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbeast%2Fcolorsys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbeast%2Fcolorsys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbeast%2Fcolorsys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbeast%2Fcolorsys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netbeast","download_url":"https://codeload.github.com/netbeast/colorsys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250536312,"owners_count":21446713,"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":["cmyk","color","css-string","hex","hsv","javascript","library","npm","random","rgb"],"created_at":"2024-11-21T22:29:40.223Z","updated_at":"2025-04-24T00:23:08.012Z","avatar_url":"https://github.com/netbeast.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# colorsys\n[![CircleCI](https://circleci.com/gh/netbeast/colorsys.svg?style=svg)](https://circleci.com/gh/netbeast/colorsys)\n![npm version](https://badge.fury.io/js/colorsys.svg)\n\n**Colorsys** is a simple javascript color conversion library that allows bidirectional color conversion.\n**Lightweight**, **immutable**. With support for RGB, HEX, HSV, HSL and CMYK and CSS strings.\n\n## install\n\n**With npm**\n```\nnpm install colorsys\n```\n\n**Load on browser or copy paste into your code**\n```\n\u003cscript src=\"https://unpkg.com/colorsys@1.0.11/colorsys.js\"\u003e\u003c/script\u003e\n```\n\n\n## example\n```javascript\nvar colorsys = require('colorsys')\nconst hsl = colorsys.parseCss('hsl(0, 0%, 100%)') //  { h: 0, s: 0, l: 100 }\ncolorsys.hsl2Hex(hsl) // '#ffffff'\nconst hsv = colorsys.rgb_to_hsv({r: 255, g: 255, b: 255 })\ncolorsys.stringify(hsv) // 'hsv(0, 0%, 100%)'\n// Parsing an hex string will result in a RGB object!\ncolorsys.parseCss('#ff00ff') // { r: 255, g: 0, b: 255 }\n```\n\nFor more examples please visit the [tests](test/test.js)\n\n## API\nFor any method the input arguments can be an object `(r: 50, g: 100, b: 0}` or a set of integers `50, 100, 0`. You have aliases in both snake_case (`hex_to_hsl`) or `rgb2Hex`, `hsv2Rgb` form.\n\n* `colorsys.parseCss(color: string)` will parse a color string in an object with the same keys.\n* `colorsys.stringify(color: Object)` will output a valid css string.\n* `colorsys.rgb_to_hsl({ r: 255, g: 255, b: 255 }) =\u003e { h: 0 , s: 0 , l: 100 }`\n* `colorsys.rgb_to_hsv({ r: 255, g: 255, b: 255 }) =\u003e { h: 0 , s: 0 , v: 100 }`\n\nTry with any combination. Look at the [source](colorsys.js) to double check!\n* `colorsys.hslToRgb`\n* `colorsys.hsvToRgb`\n* `colorsys.rgbToHex`\n* `colorsys.hexToRgb`\n* `colorsys.hsvToHex`\n* `colorsys.hexToHsv`\n* `colorsys.hslToHex`\n* `colorsys.hexToHsl`\n* `colorsys.rgb2cmyk`\n* `colorsys.cmyk2rgb`\n\nOther methods:\n* Generate a random hex color: `colorsys.random()`\n* Rotate a color hue: `colorsys.rotateHue(120, 120)` will output `240`.\nYou can also use HSL or HSV objects as `rotateHue(hsv, 120)` will output\nan object containing `{h: 240}`.\n\nThere are some formats missing like `YIQ`, `HWB`, `ansii` and `ansi16`. Please help us to complete this library making a pull request. \n\n## Contact\n* Mail us: staff [at] netbeast.co\n* Report a bug or enter discussion at [issues](https://github.com/netbeast/colorsys/issues)\n* [Twitter](https://twitter.com/YetiSmartHome)\n\nThis repo is shared with :heart: from Netbeast. This package powers [Yeti Smart Home](https://getyeti.co) and is used in production.\n\n\u003ca href=\"https://getyeti.co\" target=\"_blank\"\u003e\n   \u003cimg alt=\"works with yeti\" src=\"https://github.com/netbeast/react-native-big-slider/raw/master/works-with-yeti.png\" width=\"100\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetbeast%2Fcolorsys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetbeast%2Fcolorsys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetbeast%2Fcolorsys/lists"}