{"id":17182169,"url":"https://github.com/prettydiff/colorcontrast","last_synced_at":"2025-04-13T17:52:14.337Z","repository":{"id":26441577,"uuid":"29892405","full_name":"prettydiff/colorContrast","owner":"prettydiff","description":"accessibility color contrast tool","archived":false,"fork":false,"pushed_at":"2015-02-19T22:51:08.000Z","size":220,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T08:48:22.659Z","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":"novnc/noVNC","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prettydiff.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-01-27T02:00:43.000Z","updated_at":"2023-08-28T08:45:19.000Z","dependencies_parsed_at":"2022-08-29T15:50:17.906Z","dependency_job_id":null,"html_url":"https://github.com/prettydiff/colorContrast","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/prettydiff%2FcolorContrast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettydiff%2FcolorContrast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettydiff%2FcolorContrast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettydiff%2FcolorContrast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prettydiff","download_url":"https://codeload.github.com/prettydiff/colorContrast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248758446,"owners_count":21156957,"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-10-15T00:36:13.815Z","updated_at":"2025-04-13T17:52:14.320Z","avatar_url":"https://github.com/prettydiff.png","language":"JavaScript","readme":"﻿# [WCAG 2.0](http://www.w3.org/TR/WCAG20/) compliance color contrast\n====\n\n[Try it online](http://prettydiff.com/ignore/colorContrast/colorContrast.html)\n\nRationale\n---\n\nI found several color contrast tools online, but I found none written in JavaScript and none that compared a plurality of colors. I tired of watching my coworkers endlessly comparing two colors at a time from a limited list of approved colors. There existed a need, so I built the tool.\n\nThe intention of this application is to create all contrast comparisons for a given set of colors once. Since all colors are visible in a pass or fail state it should be immediately clear what combinations will be allowed. There is no need to even know what the acceptable rules and limitations are if using a tool like this.\n\nThe following rules defined my approach:\n\n* [Rationale for Chosen Contrast Ratios](http://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html)\n* [Relative Luminance](http://www.w3.org/TR/WCAG20/#relativeluminancedef)\n* [Contrast Ratio](http://www.w3.org/TR/WCAG20/#contrast-ratiodef)\n\nThe solution is achieved by computing the relative luminance for a given color and then comparing that color with the defined contrast ratio. The mathmatical definitions are available in the W3C links mentioned above. The JavaScript solution is available in the JavaScript function luminance of this page's source code.\n\nThe reason why I had trouble finding similar tools written in JavaScript is because JavaScript is bad at fractional arithmetic. The solution to this problem is to proportionally multiply all values by a power of ten until you are far left of the decimal. A few extra digits is recommended for extra precision.\n\nMIT License\n---\n\nCopyright (2015) Pretty Diff\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprettydiff%2Fcolorcontrast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprettydiff%2Fcolorcontrast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprettydiff%2Fcolorcontrast/lists"}