{"id":22793657,"url":"https://github.com/cmtt/color-to-alpha","last_synced_at":"2025-10-04T06:36:49.344Z","repository":{"id":27640383,"uuid":"31125104","full_name":"cmtt/color-to-alpha","owner":"cmtt","description":null,"archived":false,"fork":false,"pushed_at":"2015-02-24T11:18:12.000Z","size":244,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T12:08:24.606Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"framgia/votingsys_01","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cmtt.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":"2015-02-21T12:35:37.000Z","updated_at":"2025-03-08T20:03:13.000Z","dependencies_parsed_at":"2022-09-03T03:24:11.939Z","dependency_job_id":null,"html_url":"https://github.com/cmtt/color-to-alpha","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cmtt/color-to-alpha","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmtt%2Fcolor-to-alpha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmtt%2Fcolor-to-alpha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmtt%2Fcolor-to-alpha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmtt%2Fcolor-to-alpha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmtt","download_url":"https://codeload.github.com/cmtt/color-to-alpha/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmtt%2Fcolor-to-alpha/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278277858,"owners_count":25960428,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-12-12T03:28:13.103Z","updated_at":"2025-10-04T06:36:49.328Z","avatar_url":"https://github.com/cmtt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"color-to-alpha\n==============\n\nA function which turns a given color for the given pixel transparent while attempting to preserve anti-aliasing.\n\n[Live demo](http://cmtt.github.io/color-to-alpha)\n\nAdapted from GIMP's [color-to-alpha plugin](https://git.gnome.org/browse/gimp/tree/plug-ins/common/color-to-alpha.c?h=gimp-2-8) by Seth Burgess, licenced under GPLv3:\n\n\u003e (...) It will attempt to preserve anti-aliasing information by using a partially intelligent routine that replaces weak color information with weak alpha information. In this way, areas that contain an element of the selected color will maintain a blended appearance with their surrounding pixels.\n\nSource: [http://docs.gimp.org/en/plug-in-colortoalpha.html](http://docs.gimp.org/en/plug-in-colortoalpha.html)\n\n## Usage\n\nThis module exports solely the actual color_to_alpha function:\n\n```js\n  var col = cta([128, 128, 128, 1], [128, 128, 128]);\n  // col equals [0,0,0,0]\n\n```\n\nPlease refer to the spec/ folder as well as the example folder for more usage examples.\n\n## Helper functions\n\n\n### ``processImageData(srcImageData, dstImageData, color)``\n\nThis function removes the given color (a RGB array) from srcImageData and stores\nthe result in dstImageData.\n\n```js\n  var processImageData = require('color-to-alpha/process-image-data');\n  var color = stringToRGB('14aaeb');\n\n  var imageData = context.getImageData(0,0,img.width, img.height);\n  var dstData = context.createImageData(imageData);\n\n  processImage(imageData, dstData, color);\n\n  context.putImageData(dstData, 0, 0);\n\n```\n\n### ``stringToRGB(string)``\n\nReturns a RGB array for the given hexdecimal color code ('#00000-#ffffff').\n```js\n  var stringToRGB = require('color-to-alpha/string-to-rgb');\n  var color = stringToRGB('14aaeb');\n  // color === [ 20, 170, 235 ]\n```\n\n### ``rgbToString(string)``\n\nReturns an hexdecimal color string for the given RGB(a) array.\n\n```js\n  var rgbToString = require('color-to-alpha/rgb-to-string');\n  var color = rgbToString([ 20, 170, 235 ]);\n  // color === '#14aaeb'\n```\n\n## Demonstration\n\nIn order to try this module out interactively, you will need to build the examples.\nMake sure to install the module's depencencies, have the [Gulp](http://www.gulpjs.com) build system installed.\n\nThen run the following commands to build the example and run the tiny test suite:\n\n```bash\nnpm install\ngulp\n```\n\n## Developing\n\nIf you want to adjust something, you can start the \"watch\" task in order to run the unit tests as well as build the example at every file change.\n\nCredits\n-------\n\n* Seth Burgess wrote the original plugin for the GNU Image Manipulation Program\n* clahey\n\nLicense\n-------\n\nGPLv3","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmtt%2Fcolor-to-alpha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmtt%2Fcolor-to-alpha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmtt%2Fcolor-to-alpha/lists"}