{"id":27767964,"url":"https://github.com/bernaferrari/colorblindnessflutter","last_synced_at":"2025-08-19T02:38:36.867Z","repository":{"id":56827154,"uuid":"308979252","full_name":"bernaferrari/ColorBlindnessFlutter","owner":"bernaferrari","description":"Simulate color blindness in color themes.","archived":false,"fork":false,"pushed_at":"2024-07-10T18:32:21.000Z","size":1400,"stargazers_count":59,"open_issues_count":1,"forks_count":6,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-29T19:56:48.668Z","etag":null,"topics":["accessibility","colorblindness","flutter"],"latest_commit_sha":null,"homepage":"","language":"Dart","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/bernaferrari.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2020-10-31T22:00:03.000Z","updated_at":"2025-02-18T21:17:10.000Z","dependencies_parsed_at":"2024-08-22T23:14:11.653Z","dependency_job_id":"4bde1841-df21-45a5-a3e6-bdd0b3ee26e4","html_url":"https://github.com/bernaferrari/ColorBlindnessFlutter","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.125,"last_synced_commit":"36c723feec458aa15be2ce53956d051fa2f55422"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bernaferrari/ColorBlindnessFlutter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernaferrari%2FColorBlindnessFlutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernaferrari%2FColorBlindnessFlutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernaferrari%2FColorBlindnessFlutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernaferrari%2FColorBlindnessFlutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bernaferrari","download_url":"https://codeload.github.com/bernaferrari/ColorBlindnessFlutter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernaferrari%2FColorBlindnessFlutter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271091571,"owners_count":24697816,"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-08-19T02:00:09.176Z","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":["accessibility","colorblindness","flutter"],"created_at":"2025-04-29T19:56:41.552Z","updated_at":"2025-08-19T02:38:36.845Z","avatar_url":"https://github.com/bernaferrari.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Image of Color Blindness on Flutter](https://github.com/bernaferrari/ColorBlindnessFlutter/raw/main/assets/readme.png)\n\n# Color Blindness on Flutter\n\nEvery app has colors. How to make sure they are accessible?\nHow to avoid accessibility issues as other people in the same project start to change the Color Scheme?\nThis is a Flutter plugin that can:\n\n1. Change the whole theme, by wrapping a ColorScheme with `colorBlindnessColorScheme()`.\n2. Be used in CI tests, with `colorBlindnessAssertContrast()`.\n3. Be used to modify a single color.\n\nThe main idea is for you to (temporarily) wrap your `ColorScheme()` into a `colorBlindnessColorScheme()` with a `ColorBlindnessType` as the secondary parameter.\nDoing so, it will simulate color blindness by modifying **ALL** ColorScheme colors.\nThen, you may change the type parameter and hot refresh/restart the app to see how it looks under different eyes.\n\nThe interactive sample allows you to see how it works:\n\n\u003ca href=\"https://bernaferrari.github.io/ColorBlindnessFlutter/\"\u003e\u003cimg src=\"https://github.com/bernaferrari/ColorBlindnessFlutter/raw/main/assets/try_here.png\" height=\"50\"/\u003e\u003c/a\u003e\n\n[![Color Blindness on Flutter sample](https://github.com/bernaferrari/ColorBlindnessFlutter/raw/main/assets/sample_preview.png)](https://bernaferrari.github.io/ColorBlindnessFlutter/)\n\n## Usage\n\nIn the `pubspec.yaml` of your flutter project, add the following dependency:\n\n[![pub package](https://img.shields.io/pub/v/color_blindness.svg)](https://pub.dev/packages/color_blindness)\n\n```yaml\ndependencies:\n  color_blindness: ^VERSION\n```\n### Color Scheme\n\nIn your project, just wrap the `ColorScheme.dark(...)` with `colorBlindnessColorScheme()`.\n\n```dart\nimport 'package:color_blindness/color_blindness.dart';\n\nTheme(\n  data: ThemeData(\n    colorScheme: colorBlindnessColorScheme(ColorScheme.dark(), ColorBlindnessType.tritanopia),\n  ),\n  child: MyApp(),\n)\n```\n### CI\nYou can add a test to make sure the ColorScheme is always accessible.\nThe second parameter is the WCAG minimum threshold, which is usually at least 4.5.\n\n```dart\ncolorScheme = ColorScheme.light(\n  primary: const Color(0xff9f0042),\n  secondary: const Color(0xff1e6100),\n);\nexpect(() =\u003e colorBlindnessAssertContrast(colorScheme, 4.0), returnsNormally);\n```\n\n### Single Color\nYou can either use `colorBlindness()` with `ColorBlindnessType` as the secondary parameter, or call the methods individually. \n\n```dart\nconst primary = const Color(0xff9f0042);\n// indirect way\ncolorBlindness(primary, ColorBlindnessType.tritanopia);\n\n// direct way\ntritanopia(primary);\n```\n\n## Reasoning\nThis started in my [Color Studio project](https://github.com/bernaferrari/color-studio). There, you can preview different color blindness in different themes.\nHowever, I saw the possibility of contribution for those already using ColorScheme in an existing app.\nSimilar to [RandomColorScheme](https://github.com/bernaferrari/RandomColorScheme), this may reach deeper places than Color Studio ever will.\nAlso, there were ZERO packages in pub.dev related to color blindness, so this was the first one.\nThe color blindness calculation was retrieved from [ColorBlinds](https://github.com/jordidekock/Colorblinds) project.\n\n## Function listing\n- `colorBlindnessColorScheme(scheme: ColorScheme, type: ColorBlindnessType): ColorScheme`\n- `colorBlindnessAssertContrast(scheme: ColorScheme, minThreshold: double = 4.5)`\n- `colorBlindness(color: Color, type: ColorBlindnessType): Color`\n- `protanomaly(color: Color): Color`\n- `deuteranomaly(color: Color): Color`\n- `tritanomaly(color: Color): Color`\n- `protanopia(color: Color): Color`\n- `deuteranopia(color: Color): Color`\n- `tritanopia(color: Color): Color`\n- `achromatopsia(color: Color): Color`\n- `achromatomaly(color: Color): Color`\n    \n`enum ColorBlindnessType { none, protanomaly, deuteranomaly, tritanomaly, protanopia, deuteranopia, tritanopia, achromatopsia, achromatomaly }`\n## Reporting Issues\n\nIf you have any suggestions or feedback, issues and pull requests are welcome.\nYou can report [here](https://github.com/bernaferrari/ColorBlindnessFlutter/issues).\n\n## License\n\n    Copyright 2020 Bernardo Ferrari\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbernaferrari%2Fcolorblindnessflutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbernaferrari%2Fcolorblindnessflutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbernaferrari%2Fcolorblindnessflutter/lists"}