@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a "Red/Green Colorblind" accessibility mode, make all web UIs and email respect it

Summary:
Fixes T12172. Fixes T12060. This allows runtime code building CSS for mail to read CSS variables, then makes all the code do that.

It reverts the non-colorblind red/green to the colors in use before T12060, which seem better for non-colorblind users since no one really complained?

Test Plan:
- Viewed code diffs in Web UI.
- Viewed prose diffs in Web UI.
- Viewed code diffs in email.
- Viewed prose diffs in email.

All modes respected the accessibility color scheme.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12172, T12060

Differential Revision: https://secure.phabricator.com/D17269

+65 -14
+6 -6
resources/celerity/map.php
··· 12 12 'core.pkg.css' => '12c56bd9', 13 13 'core.pkg.js' => '1fa7c0c5', 14 14 'darkconsole.pkg.js' => 'e7393ebb', 15 - 'differential.pkg.css' => '4815647b', 15 + 'differential.pkg.css' => '90b30783', 16 16 'differential.pkg.js' => 'ddfeb49b', 17 17 'diffusion.pkg.css' => '91c5d3a6', 18 18 'diffusion.pkg.js' => '84c8f8fd', ··· 58 58 'rsrc/css/application/dashboard/dashboard.css' => '0921c307', 59 59 'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a', 60 60 'rsrc/css/application/differential/add-comment.css' => 'c47f8c40', 61 - 'rsrc/css/application/differential/changeset-view.css' => '6a9bdf9c', 61 + 'rsrc/css/application/differential/changeset-view.css' => '41af6d25', 62 62 'rsrc/css/application/differential/core.css' => '5b7b8ff4', 63 63 'rsrc/css/application/differential/phui-inline-comment.css' => 'be663c95', 64 64 'rsrc/css/application/differential/revision-comment.css' => '14b8565a', ··· 572 572 'conpherence-thread-manager' => 'c8b5ee6f', 573 573 'conpherence-transaction-css' => '85129c68', 574 574 'd3' => 'a11a5ff2', 575 - 'differential-changeset-view-css' => '6a9bdf9c', 575 + 'differential-changeset-view-css' => '41af6d25', 576 576 'differential-core-view-css' => '5b7b8ff4', 577 577 'differential-inline-comment-editor' => '2e3f9738', 578 578 'differential-revision-add-comment-css' => 'c47f8c40', ··· 1166 1166 'javelin-dom', 1167 1167 'javelin-reactor-dom', 1168 1168 ), 1169 + '41af6d25' => array( 1170 + 'phui-inline-comment-view-css', 1171 + ), 1169 1172 42126667 => array( 1170 1173 'javelin-behavior', 1171 1174 'javelin-dom', ··· 1385 1388 ), 1386 1389 '69adf288' => array( 1387 1390 'javelin-install', 1388 - ), 1389 - '6a9bdf9c' => array( 1390 - 'phui-inline-comment-view-css', 1391 1391 ), 1392 1392 '6ad39b6f' => array( 1393 1393 'javelin-install',
+2
src/__phutil_library_map__.php
··· 235 235 'CelerityPhysicalResourcesTestCase' => 'applications/celerity/resources/__tests__/CelerityPhysicalResourcesTestCase.php', 236 236 'CelerityPostprocessor' => 'applications/celerity/postprocessor/CelerityPostprocessor.php', 237 237 'CelerityPostprocessorTestCase' => 'applications/celerity/__tests__/CelerityPostprocessorTestCase.php', 238 + 'CelerityRedGreenPostprocessor' => 'applications/celerity/postprocessor/CelerityRedGreenPostprocessor.php', 238 239 'CelerityResourceController' => 'applications/celerity/controller/CelerityResourceController.php', 239 240 'CelerityResourceGraph' => 'applications/celerity/CelerityResourceGraph.php', 240 241 'CelerityResourceMap' => 'applications/celerity/CelerityResourceMap.php', ··· 4911 4912 'CelerityPhysicalResourcesTestCase' => 'PhabricatorTestCase', 4912 4913 'CelerityPostprocessor' => 'Phobject', 4913 4914 'CelerityPostprocessorTestCase' => 'PhabricatorTestCase', 4915 + 'CelerityRedGreenPostprocessor' => 'CelerityPostprocessor', 4914 4916 'CelerityResourceController' => 'PhabricatorController', 4915 4917 'CelerityResourceGraph' => 'AbstractDirectedGraph', 4916 4918 'CelerityResourceMap' => 'Phobject',
+4 -4
src/applications/celerity/postprocessor/CelerityDefaultPostprocessor.php
··· 193 193 'sh-disabledbackground' => '#f3f3f3', 194 194 195 195 // Diffs 196 - 'new-background' => '#eaffea', 197 - 'new-bright' => '#a6f3a6', 198 - 'old-background' => '#ffecec', 199 - 'old-bright' => '#f8cbcb', 196 + 'new-background' => 'rgba(151, 234, 151, .3)', 197 + 'new-bright' => 'rgba(151, 234, 151, .6)', 198 + 'old-background' => 'rgba(251, 175, 175, .3)', 199 + 'old-bright' => 'rgba(251, 175, 175, .7)', 200 200 'move-background' => '#fdf5d4', 201 201 'copy-background' => '#f1c40f', 202 202
+23
src/applications/celerity/postprocessor/CelerityRedGreenPostprocessor.php
··· 1 + <?php 2 + 3 + final class CelerityRedGreenPostprocessor 4 + extends CelerityPostprocessor { 5 + 6 + public function getPostprocessorKey() { 7 + return 'redgreen'; 8 + } 9 + 10 + public function getPostprocessorName() { 11 + return pht('Use Red/Green (Deuteranopia) Colors'); 12 + } 13 + 14 + public function buildVariables() { 15 + return array( 16 + 'new-background' => 'rgba(152, 207, 235, .15)', 17 + 'new-bright' => 'rgba(152, 207, 235, .35)', 18 + 'old-background' => 'rgba(250, 212, 175, .3)', 19 + 'old-bright' => 'rgba(250, 212, 175, .55)', 20 + ); 21 + } 22 + 23 + }
+6 -2
src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php
··· 51 51 protected function renderPrimitives(array $primitives, $rows) { 52 52 $out = array(); 53 53 54 + $viewer = $this->getUser(); 55 + $old_bright = $viewer->getCSSValue('old-bright'); 56 + $new_bright = $viewer->getCSSValue('new-bright'); 57 + 54 58 $context_style = array( 55 59 'background: #F7F7F7;', 56 60 'color: #74777D;', ··· 72 76 73 77 if ($is_old) { 74 78 if ($p['htype']) { 75 - $style = 'background: #ffd0d0;'; 79 + $style = "background: {$old_bright};"; 76 80 } else { 77 81 $style = null; 78 82 } 79 83 } else { 80 84 if ($p['htype']) { 81 - $style = 'background: #d0ffd0;'; 85 + $style = "background: {$new_bright};"; 82 86 } else { 83 87 $style = null; 84 88 }
+18
src/applications/people/storage/PhabricatorUser.php
··· 1580 1580 return $this; 1581 1581 } 1582 1582 1583 + 1584 + public function getCSSValue($variable_key) { 1585 + $preference = PhabricatorAccessibilitySetting::SETTINGKEY; 1586 + $key = $this->getUserSetting($preference); 1587 + 1588 + $postprocessor = CelerityPostprocessor::getPostprocessor($key); 1589 + $variables = $postprocessor->getVariables(); 1590 + 1591 + if (!isset($variables[$variable_key])) { 1592 + throw new Exception( 1593 + pht( 1594 + 'Unknown CSS variable "%s"!', 1595 + $variable_key)); 1596 + } 1597 + 1598 + return $variables[$variable_key]; 1599 + } 1600 + 1583 1601 }
+6 -2
src/applications/transactions/view/PhabricatorApplicationTransactionTextDiffDetailView.php
··· 19 19 public function renderForMail() { 20 20 $diff = $this->buildDiff(); 21 21 22 + $viewer = $this->getViewer(); 23 + $old_bright = $viewer->getCSSValue('old-bright'); 24 + $new_bright = $viewer->getCSSValue('new-bright'); 25 + 22 26 $old_styles = array( 23 27 'padding: 0 2px;', 24 28 'color: #333333;', 25 - 'background: #f8cbcb;', 29 + "background: {$old_bright};", 26 30 ); 27 31 $old_styles = implode(' ', $old_styles); 28 32 29 33 $new_styles = array( 30 34 'padding: 0 2px;', 31 35 'color: #333333;', 32 - 'background: #a6f3a6;', 36 + "background: {$new_bright};", 33 37 ); 34 38 $new_styles = implode(' ', $new_styles); 35 39