{"id":16758148,"url":"https://github.com/foo123/css-color","last_synced_at":"2026-05-16T13:08:03.321Z","repository":{"id":13838575,"uuid":"16535517","full_name":"foo123/css-color","owner":"foo123","description":"simple class for manipulating color values and color formats for css, svg, canvas/image","archived":false,"fork":false,"pushed_at":"2023-07-30T12:39:49.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T07:28:05.034Z","etag":null,"topics":["color-conversion","css"],"latest_commit_sha":null,"homepage":"https://foo123.github.io/","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/foo123.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-05T04:57:13.000Z","updated_at":"2022-12-17T20:43:15.000Z","dependencies_parsed_at":"2025-01-22T19:55:24.106Z","dependency_job_id":null,"html_url":"https://github.com/foo123/css-color","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/foo123/css-color","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fcss-color","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fcss-color/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fcss-color/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fcss-color/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foo123","download_url":"https://codeload.github.com/foo123/css-color/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fcss-color/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33103999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-conversion","css"],"created_at":"2024-10-13T04:04:17.893Z","updated_at":"2026-05-16T13:08:03.296Z","avatar_url":"https://github.com/foo123.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"css-color\n=========\n\nClass for manipulating color values for css, svg, canvas/image, etc..\n\nversion **1.0.0**\n\n**Color Formats: HEX, RGB(A), HSL(A), HWB, HSV, CMYK**\n\n**example:**\n\n```javascript\n\nlet rgb = new Color([128, 255, 245, 1]).toRGB(asString, condenced, noTransparency);\nlet hsl = new Color([128, 255, 245, 1]).toHSL(asString, condenced, noTransparency);\nlet hwb = new Color([128, 255, 245, 1]).toHWB(asString, condenced, noTransparency);\nlet cmyk = new Color([128, 255, 245, 1]).toCMYK(asString, condenced, withTransparency);\n\n// or using a constructor factory pattern\nlet rgb = Color([128, 255, 245, 1]).toRGB(asString, condenced, noTransparency);\nlet hsl = Color([128, 255, 245, 1]).toHSL(asString, condenced, noTransparency);\nlet hwb = Color([128, 255, 245, 1]).toHWB(asString, condenced, noTransparency);\nlet cmyk = Color([128, 255, 245, 1]).toCMYK(asString, condenced, withTransparency);\n\nlet color = new Color().fromRGB([255, 255, 255, 0.3]);\n// or via static method\nlet color = Color.fromRGB([255, 255, 255]);\n\nlet color = new Color().fromHSL([120, 50, 100, 0.7]);\n// or via static method\nlet color = Color.fromHSL([120, 50, 100]);\n\nlet color = new Color().fromHSV([120, 50, 100, 0.7]);\n// or via static method\nlet color = CSS.Color.fromHSV([120, 50, 100]);\n\nlet color = new Color().fromHWB([120, 50, 100, 0.7]);\n// or via static method\nlet color = Color.fromHWB([120, 50, 100]);\n\nlet color = new Color().fromHEX([0xff, 0xaa, 0x00, 0xfa]);\n// or via static method\nlet color = Color.fromHEX([0xff, 0xaa, 0x00]);\n\nlet color = new Color().fromPixel(0xff3d1208);\n// or via static method\nlet color = Color.fromPixel(0xff3d1208);\n\nlet color = new Color().fromKeyword('orange');\n// or via static method\nlet color = Color.fromKeyword('orange');\n\nlet color = new Color().fromCMYK([1, 0.3, 0.5, 1]);\n// or via static method\nlet color = Color.fromCMYK([1, 0.3, 0.5, 1]);\n\n// also\nlet color = Color.fromString('rgba(255, 100%, 100%, 0.7)');\nlet color = Color.fromString('hsla(120, 50%, 100%, 0.5)');\nlet color = Color.fromString('hwb(120 50% 100% / 0.5)');\nlet color = Color.fromString('#fff');\nlet color = Color.fromString('slategrey');\n\n// output\nconsole.log(color.toHSL(asString, condenced, noTransparency)); // hsla(..)\nconsole.log(color.toHWB(asString, condenced, noTransparency)); // hwb(..)\nconsole.log(color.toHEX(asString, condenced, withTransparency)); // #..\nconsole.log(color.toRGB(asString, condenced, noTransparency)); // rgb(255, 255, 255)\nconsole.log(color.toHSL(asString, condenced, noTransparency)); // hsl(..)\nconsole.log(color.toHWB(asString, condenced, noTransparency)); // hwb(..)\nconsole.log(color.toCMYK(asString, condenced, withTransparency)); // CMYK: [..]\nconsole.log(color.toPixel(withTransparency)); // 0x...\nconsole.log(color.toKeyword(asString, condenced, withTransparency)); // only if color was set from keyword\n\n// also\nconsole.log(color.toString('hsla', condenced));\nconsole.log(color.toString('hsl', condenced));\nconsole.log(color.toString('hwb', condenced));\nconsole.log(color.toString('rgb', condenced));\nconsole.log(color.toString('rgba', condenced));\nconsole.log(color.toString('keyword', condenced)); // only if color was set from keyword\nconsole.log(color.toString('hex', condenced));\nconsole.log(color.toString('hexie', condenced));  // with transparency added\n\n// etc ..\n\n// also\nconsole.log(color.isTransparent());  // whether color has opacity \u003c 1\nconsole.log(color.isKeyword());  // whether color was set from a keyword\n\n\n// also\ncolor.colorStop('0%'); // set an associated color stop to this color\nconsole.log(color.toColorStop(compatible));  // rgba(..) 0%\n\n```\n\n**see also:**\n\n* [CanvasLite](https://github.com/foo123/CanvasLite) an html canvas implementation in pure JavaScript\n* [Rasterizer](https://github.com/foo123/Rasterizer) stroke and fill lines, rectangles, curves and paths, without canvaσ\n* [Gradient](https://github.com/foo123/Gradient) create linear, radial, conic and elliptic gradients and image patterns without canvas\n* [Geometrize](https://github.com/foo123/Geometrize) Computational Geometry and Rendering Library for JavaScript\n* [Plot.js](https://github.com/foo123/Plot.js) simple and small library which can plot graphs of functions and various simple charts and can render to Canvas, SVG and plain HTML\n* [MOD3](https://github.com/foo123/MOD3) 3D Modifier Library in JavaScript\n* [HAAR.js](https://github.com/foo123/HAAR.js) image feature detection based on Haar Cascades in JavaScript (Viola-Jones-Lienhart et al Algorithm)\n* [HAARPHP](https://github.com/foo123/HAARPHP) image feature detection based on Haar Cascades in PHP (Viola-Jones-Lienhart et al Algorithm)\n* [FILTER.js](https://github.com/foo123/FILTER.js) video and image processing and computer vision Library in pure JavaScript (browser and node)\n* [css-color](https://github.com/foo123/css-color) simple class to parse and manipulate colors in various formats\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Fcss-color","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoo123%2Fcss-color","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Fcss-color/lists"}