{"id":20877696,"url":"https://github.com/dafrok/color-factory","last_synced_at":"2026-04-26T14:31:29.445Z","repository":{"id":57203259,"uuid":"59413375","full_name":"Dafrok/color-factory","owner":"Dafrok","description":"CSS colors converter","archived":false,"fork":false,"pushed_at":"2018-04-09T03:42:07.000Z","size":42,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-21T18:48:49.094Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dafrok.github.io/css-color-playground/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dafrok.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-22T13:18:29.000Z","updated_at":"2018-04-09T03:42:09.000Z","dependencies_parsed_at":"2022-09-17T00:51:37.389Z","dependency_job_id":null,"html_url":"https://github.com/Dafrok/color-factory","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dafrok%2Fcolor-factory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dafrok%2Fcolor-factory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dafrok%2Fcolor-factory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dafrok%2Fcolor-factory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dafrok","download_url":"https://codeload.github.com/Dafrok/color-factory/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243251494,"owners_count":20261217,"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-11-18T06:58:17.956Z","updated_at":"2025-12-25T14:38:54.228Z","avatar_url":"https://github.com/Dafrok.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# color-factory\nCSS colors transformer\n\n## Try It Out\n\nhttps://dafrok.github.io/css-color-playground/\n\n## Install\n```\n$ npm i color-factory\n```\n\n## Usage\n```es6\nimport Color from 'color-factory'\n\nconst colorFromString = new Color('rgba(12, 34, 56, 0.7)')\ncolorFromString.toHex()\ncolorFromString.h(100).s(0.4).b(30).toHSL()\ncolorFromString.g()\n\nconst colorFromObject = new Color({h: 100, s: 0.5, l: 0.3})\ncolorFromObject.toRGBA()\n```\n\n## API\n\n#### .toHEX()\n\nConvert color instance to CSS hex string.\n\n#### .toRGB()\n\nConvert color instance to CSS rgb string.\n\n#### .toRGBA()\n\nConvert color instance to CSS rgba string.\n\n#### .toHSL()\n\nConvert color instance to CSS hsl string.\n\n#### .toHSLA()\n\nConvert color instance to CSS hsla string.\n\n#### .toSTRING()\n\nConvert color instance to CSS color string, such as 'red', 'blue', 'transparent' etc.\n\n#### .r()\n\nGet the value of red channel.\n\n#### .r(value)\n\n- value\n  - Type: String\n  - Description: Set the value of red channel.\n- Return: this\n\n#### .g()\n\nGet the value of green channel.\n\n#### .g(value)\n\n- value\n  - Type: String\n  - Description: Set the value of green channel.\n- Return: this\n\n#### .b()\n\nGet the value of blue channel.\n\n#### .b(value)\n\n- value\n  - Type: String\n  - Description: Set the value of blue channel.\n- Return: this\n\n#### .h()\n\nGet the value of hue.\n\n#### .h(value)\n\n- value\n  - Type: String\n  - Description: Set the value of hue.\n- Return: this\n\n#### .s()\n\nGet the value of saturation.\n\n#### .s(value)\n\n- value\n  - Type: String\n  - Description: Set the value of saturation.\n- Return: this\n\n#### .l()\n\nGet the value of lightness.\n\n#### .l(value)\n\n- value\n  - Type: String\n  - Description: Set the value of lightness.\n- Return: this\n\n#### .a()\n\nGet the value of alpha channel.\n\n#### .a(value)\n\n- value\n  - Type: String\n  - Description: Set the value of alpha.\n- Return: this\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdafrok%2Fcolor-factory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdafrok%2Fcolor-factory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdafrok%2Fcolor-factory/lists"}