@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.

Modularize Celerity postprocessors

Summary: Not sure if we want this, but it seems to work fine.

Test Plan: {F516736}

Reviewers: joshuaspence, chad

Reviewed By: joshuaspence, chad

Subscribers: joshuaspence, epriestley

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

+415 -179
+8 -8
resources/celerity/map.php
··· 7 7 */ 8 8 return array( 9 9 'names' => array( 10 - 'core.pkg.css' => '87e6e18f', 10 + 'core.pkg.css' => '173fc33c', 11 11 'core.pkg.js' => 'f1e8abd7', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 13 'differential.pkg.css' => 'fe951924', ··· 33 33 'rsrc/css/aphront/typeahead.css' => '0e403212', 34 34 'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af', 35 35 'rsrc/css/application/auth/auth.css' => 'dc62cb0e', 36 - 'rsrc/css/application/base/main-menu-view.css' => '44b4a289', 36 + 'rsrc/css/application/base/main-menu-view.css' => '3cd48671', 37 37 'rsrc/css/application/base/notification-menu.css' => 'f31c0bde', 38 38 'rsrc/css/application/base/phabricator-application-launch-view.css' => '9a233ed6', 39 39 'rsrc/css/application/base/phui-theme.css' => 'd4a49411', ··· 107 107 'rsrc/css/application/slowvote/slowvote.css' => '266df6a1', 108 108 'rsrc/css/application/tokens/tokens.css' => '3d0f239e', 109 109 'rsrc/css/application/uiexample/example.css' => '528b19de', 110 - 'rsrc/css/core/core.css' => '47adcf87', 110 + 'rsrc/css/core/core.css' => 'a76cefc9', 111 111 'rsrc/css/core/remarkup.css' => 'a4f23e80', 112 112 'rsrc/css/core/syntax.css' => '9fd11da8', 113 113 'rsrc/css/core/z-index.css' => '63689f49', ··· 708 708 'phabricator-busy' => '59a7976a', 709 709 'phabricator-chatlog-css' => 'f1971c1c', 710 710 'phabricator-content-source-view-css' => '4b8b05d4', 711 - 'phabricator-core-css' => '47adcf87', 711 + 'phabricator-core-css' => 'a76cefc9', 712 712 'phabricator-countdown-css' => '86b7b0a0', 713 713 'phabricator-dashboard-css' => 'eb458607', 714 714 'phabricator-drag-and-drop-file-upload' => '07de8873', ··· 722 722 'phabricator-hovercard-view-css' => '0a08eb6c', 723 723 'phabricator-keyboard-shortcut' => '1ae869f2', 724 724 'phabricator-keyboard-shortcut-manager' => 'c1700f6f', 725 - 'phabricator-main-menu-view' => '44b4a289', 725 + 'phabricator-main-menu-view' => '3cd48671', 726 726 'phabricator-nav-view-css' => '0ecd30a1', 727 727 'phabricator-notification' => '0c6946e7', 728 728 'phabricator-notification-css' => '9c279160', ··· 1063 1063 'javelin-util', 1064 1064 'javelin-uri', 1065 1065 ), 1066 + '3cd48671' => array( 1067 + 'phui-theme-css', 1068 + ), 1066 1069 '3ee3408b' => array( 1067 1070 'javelin-behavior', 1068 1071 'javelin-behavior-device', ··· 1093 1096 'javelin-util', 1094 1097 'javelin-uri', 1095 1098 'javelin-install', 1096 - ), 1097 - '44b4a289' => array( 1098 - 'phui-theme-css', 1099 1099 ), 1100 1100 '453c5375' => array( 1101 1101 'javelin-behavior',
+8
src/__phutil_library_map__.php
··· 179 179 'CalendarTimeUtil' => 'applications/calendar/util/CalendarTimeUtil.php', 180 180 'CalendarTimeUtilTestCase' => 'applications/calendar/__tests__/CalendarTimeUtilTestCase.php', 181 181 'CelerityAPI' => 'applications/celerity/CelerityAPI.php', 182 + 'CelerityDefaultPostprocessor' => 'applications/celerity/postprocessor/CelerityDefaultPostprocessor.php', 183 + 'CelerityHighContrastPostprocessor' => 'applications/celerity/postprocessor/CelerityHighContrastPostprocessor.php', 182 184 'CelerityManagementMapWorkflow' => 'applications/celerity/management/CelerityManagementMapWorkflow.php', 183 185 'CelerityManagementWorkflow' => 'applications/celerity/management/CelerityManagementWorkflow.php', 184 186 'CelerityPhabricatorResourceController' => 'applications/celerity/controller/CelerityPhabricatorResourceController.php', 185 187 'CelerityPhabricatorResources' => 'applications/celerity/resources/CelerityPhabricatorResources.php', 186 188 'CelerityPhysicalResources' => 'applications/celerity/resources/CelerityPhysicalResources.php', 187 189 'CelerityPhysicalResourcesTestCase' => 'applications/celerity/resources/__tests__/CelerityPhysicalResourcesTestCase.php', 190 + 'CelerityPostprocessor' => 'applications/celerity/postprocessor/CelerityPostprocessor.php', 191 + 'CelerityPostprocessorTestCase' => 'applications/celerity/__tests__/CelerityPostprocessorTestCase.php', 188 192 'CelerityResourceController' => 'applications/celerity/controller/CelerityResourceController.php', 189 193 'CelerityResourceGraph' => 'applications/celerity/CelerityResourceGraph.php', 190 194 'CelerityResourceMap' => 'applications/celerity/CelerityResourceMap.php', ··· 3504 3508 'CalendarTimeUtil' => 'Phobject', 3505 3509 'CalendarTimeUtilTestCase' => 'PhabricatorTestCase', 3506 3510 'CelerityAPI' => 'Phobject', 3511 + 'CelerityDefaultPostprocessor' => 'CelerityPostprocessor', 3512 + 'CelerityHighContrastPostprocessor' => 'CelerityPostprocessor', 3507 3513 'CelerityManagementMapWorkflow' => 'CelerityManagementWorkflow', 3508 3514 'CelerityManagementWorkflow' => 'PhabricatorManagementWorkflow', 3509 3515 'CelerityPhabricatorResourceController' => 'CelerityResourceController', 3510 3516 'CelerityPhabricatorResources' => 'CelerityResourcesOnDisk', 3511 3517 'CelerityPhysicalResources' => 'CelerityResources', 3512 3518 'CelerityPhysicalResourcesTestCase' => 'PhabricatorTestCase', 3519 + 'CelerityPostprocessor' => 'Phobject', 3520 + 'CelerityPostprocessorTestCase' => 'PhabricatorTestCase', 3513 3521 'CelerityResourceController' => 'PhabricatorController', 3514 3522 'CelerityResourceGraph' => 'AbstractDirectedGraph', 3515 3523 'CelerityResourceMap' => 'Phobject',
+13
src/aphront/response/AphrontAjaxResponse.php
··· 59 59 $this->encodeJSONForHTTPResponse($content); 60 60 61 61 $response = CelerityAPI::getStaticResourceResponse(); 62 + 63 + $request = $this->getRequest(); 64 + if ($request) { 65 + $viewer = $request->getViewer(); 66 + if ($viewer) { 67 + $postprocessor_key = $viewer->getPreference( 68 + PhabricatorUserPreferences::PREFERENCE_RESOURCE_POSTPROCESSOR); 69 + if (strlen($postprocessor_key)) { 70 + $response->setPostprocessorKey($postprocessor_key); 71 + } 72 + } 73 + } 74 + 62 75 $object = $response->buildAjaxResponse( 63 76 $content['payload'], 64 77 $this->error);
+24 -166
src/applications/celerity/CelerityResourceTransformer.php
··· 7 7 private $celerityMap; 8 8 private $translateURICallback; 9 9 private $currentPath; 10 + private $postprocessorKey; 11 + private $variableMap; 12 + 13 + public function setPostprocessorKey($postprocessor_key) { 14 + $this->postprocessorKey = $postprocessor_key; 15 + return $this; 16 + } 17 + 18 + public function getPostprocessorKey() { 19 + return $this->postprocessorKey; 20 + } 10 21 11 22 public function setTranslateURICallback($translate_uricallback) { 12 23 $this->translateURICallback = $translate_uricallback; ··· 169 180 $data); 170 181 } 171 182 172 - public static function getCSSVariableMap() { 173 - return array( 174 - // Fonts 175 - 'basefont' => "13px 'Segoe UI', 'Segoe UI Web Regular', ". 176 - "'Segoe UI Symbol', 'Lato', 'Helvetica Neue', Helvetica, ". 177 - "Arial, sans-serif", 178 - 179 - 'fontfamily' => "'Segoe UI', 'Segoe UI Web Regular', ". 180 - "'Segoe UI Symbol', 'Lato', 'Helvetica Neue', Helvetica, ". 181 - "Arial, sans-serif", 182 - 183 - // Drop Shadow 184 - 'dropshadow' => '0 1px 6px rgba(0, 0, 0, .25)', 185 - 'whitetextshadow' => '0 1px 0 rgba(255, 255, 255, 1)', 186 - 187 - // Anchors 188 - 'anchor' => '#136CB2', 189 - 190 - // Base Colors 191 - 'red' => '#c0392b', 192 - 'lightred' => '#f4dddb', 193 - 'orange' => '#e67e22', 194 - 'lightorange' => '#f7e2d4', 195 - 'yellow' => '#f1c40f', 196 - 'lightyellow' => '#fdf5d4', 197 - 'green' => '#139543', 198 - 'lightgreen' => '#d7eddf', 199 - 'blue' => '#2980b9', 200 - 'lightblue' => '#daeaf3', 201 - 'sky' => '#3498db', 202 - 'lightsky' => '#ddeef9', 203 - 'fire' => '#e62f17', 204 - 'indigo' => '#6e5cb6', 205 - 'lightindigo' => '#eae6f7', 206 - 'pink' => '#da49be', 207 - 'lightpink' => '#fbeaf8', 208 - 'violet' => '#8e44ad', 209 - 'lightviolet' => '#ecdff1', 210 - 'charcoal' => '#4b4d51', 211 - 'backdrop' => '#dadee7', 212 - 'hoverwhite' => 'rgba(255,255,255,.6)', 213 - 'hovergrey' => '#c5cbcf', 214 - 'hoverblue' => '#eceff5', 215 - 'hoverborder' => '#dfe1e9', 216 - 'hoverselectedgrey' => '#bbc4ca', 217 - 'hoverselectedblue' => '#e6e9ee', 218 - 'borderinset' => 'inset 0 0 0 1px rgba(55,55,55,.15)', 219 - 220 - // Base Greys 221 - 'lightgreyborder' => '#C7CCD9', 222 - 'greyborder' => '#A1A6B0', 223 - 'darkgreyborder' => '#676A70', 224 - 'lightgreytext' => '#92969D', 225 - 'greytext' => '#74777D', 226 - 'darkgreytext' => '#4B4D51', 227 - 'lightgreybackground' => '#F7F7F7', 228 - 'greybackground' => '#EBECEE', 229 - 'darkgreybackground' => '#DFE0E2', 230 - 231 - // Base Blues 232 - 'thinblueborder' => '#DDE8EF', 233 - 'lightblueborder' => '#BFCFDA', 234 - 'blueborder' => '#8C98B8', 235 - 'darkblueborder' => '#626E82', 236 - 'lightbluebackground' => '#F8F9FC', 237 - 'bluebackground' => '#DAE7FF', 238 - 'lightbluetext' => '#8C98B8', 239 - 'bluetext' => '#6B748C', 240 - 'darkbluetext' => '#464C5C', 241 - 242 - // Base Greens 243 - 'lightgreenborder' => '#bfdac1', 244 - 'greenborder' => '#8cb89c', 245 - 'greentext' => '#3e6d35', 246 - 'lightgreenbackground' => '#e6f2e4', 247 - 248 - // Base Red 249 - 'lightredborder' => '#f4c6c6', 250 - 'redborder' => '#eb9797', 251 - 'redtext' => '#802b2b', 252 - 'lightredbackground' => '#f5e1e1', 253 - 254 - // Base Violet 255 - 'lightvioletborder' => '#cfbddb', 256 - 'violetborder' => '#b589ba', 257 - 'violettext' => '#603c73', 258 - 'lightvioletbackground' => '#e9dfee', 259 - 260 - // Shades are a more muted set of our base colors 261 - // better suited to blending into other UIs. 262 - 263 - // Shade Red 264 - 'sh-lightredborder' => '#efcfcf', 265 - 'sh-redborder' => '#d1abab', 266 - 'sh-redicon' => '#c85a5a', 267 - 'sh-redtext' => '#a53737', 268 - 'sh-redbackground' => '#f7e6e6', 269 - 270 - // Shade Orange 271 - 'sh-lightorangeborder' => '#f8dcc3', 272 - 'sh-orangeborder' => '#dbb99e', 273 - 'sh-orangeicon' => '#e78331', 274 - 'sh-orangetext' => '#ba6016', 275 - 'sh-orangebackground' => '#fbede1', 276 - 277 - // Shade Yellow 278 - 'sh-lightyellowborder' => '#e9dbcd', 279 - 'sh-yellowborder' => '#c9b8a8', 280 - 'sh-yellowicon' => '#9b946e', 281 - 'sh-yellowtext' => '#726f56', 282 - 'sh-yellowbackground' => '#fdf3da', 183 + public function getCSSVariableMap() { 184 + $postprocessor_key = $this->getPostprocessorKey(); 185 + $postprocessor = CelerityPostprocessor::getPostprocessor( 186 + $postprocessor_key); 283 187 284 - // Shade Green 285 - 'sh-lightgreenborder' => '#c6e6c7', 286 - 'sh-greenborder' => '#a0c4a1', 287 - 'sh-greenicon' => '#4ca74e', 288 - 'sh-greentext' => '#326d34', 289 - 'sh-greenbackground' => '#ddefdd', 188 + if (!$postprocessor) { 189 + $postprocessor = CelerityPostprocessor::getPostprocessor( 190 + CelerityDefaultPostprocessor::POSTPROCESSOR_KEY); 191 + } 290 192 291 - // Shade Blue 292 - 'sh-lightblueborder' => '#cfdbe3', 293 - 'sh-blueborder' => '#a7b5bf', 294 - 'sh-blueicon' => '#6b748c', 295 - 'sh-bluetext' => '#464c5c', 296 - 'sh-bluebackground' => '#dee7f8', 297 - 298 - // Shade Indigo 299 - 'sh-lightindigoborder' => '#d1c9ee', 300 - 'sh-indigoborder' => '#bcb4da', 301 - 'sh-indigoicon' => '#8672d4', 302 - 'sh-indigotext' => '#6e5cb6', 303 - 'sh-indigobackground' => '#eae6f7', 304 - 305 - // Shade Violet 306 - 'sh-lightvioletborder' => '#e0d1e7', 307 - 'sh-violetborder' => '#bcabc5', 308 - 'sh-violeticon' => '#9260ad', 309 - 'sh-violettext' => '#69427f', 310 - 'sh-violetbackground' => '#efe8f3', 311 - 312 - // Shade Pink 313 - 'sh-lightpinkborder' => '#f6d5ef', 314 - 'sh-pinkborder' => '#d5aecd', 315 - 'sh-pinkicon' => '#e26fcb', 316 - 'sh-pinktext' => '#da49be', 317 - 'sh-pinkbackground' => '#fbeaf8', 318 - 319 - // Shade Grey 320 - 'sh-lightgreyborder' => '#d8d8d8', 321 - 'sh-greyborder' => '#b2b2b2', 322 - 'sh-greyicon' => '#757575', 323 - 'sh-greytext' => '#555555', 324 - 'sh-greybackground' => '#e7e7e7', 325 - 326 - // Shade Disabled 327 - 'sh-lightdisabledborder' => '#e5e5e5', 328 - 'sh-disabledborder' => '#cbcbcb', 329 - 'sh-disabledicon' => '#bababa', 330 - 'sh-disabledtext' => '#a6a6a6', 331 - 'sh-disabledbackground' => '#f3f3f3', 332 - 333 - ); 193 + return $postprocessor->getVariables(); 334 194 } 335 - 336 195 337 196 public function replaceCSSVariable($matches) { 338 - static $map; 339 - if (!$map) { 340 - $map = self::getCSSVariableMap(); 197 + if (!$this->variableMap) { 198 + $this->variableMap = $this->getCSSVariableMap(); 341 199 } 342 200 343 201 $var_name = $matches[1]; 344 - if (empty($map[$var_name])) { 202 + if (empty($this->variableMap[$var_name])) { 345 203 $path = $this->currentPath; 346 204 throw new Exception( 347 205 pht( ··· 350 208 $var_name)); 351 209 } 352 210 353 - return $map[$var_name]; 211 + return $this->variableMap[$var_name]; 354 212 } 355 213 356 214 public function replaceCSSPrintRule($matches) {
+16
src/applications/celerity/CelerityStaticResourceResponse.php
··· 15 15 private $metadataBlock = 0; 16 16 private $behaviors = array(); 17 17 private $hasRendered = array(); 18 + private $postprocessorKey; 18 19 19 20 public function __construct() { 20 21 if (isset($_REQUEST['__metablock__'])) { ··· 30 31 31 32 public function getMetadataBlock() { 32 33 return $this->metadataBlock; 34 + } 35 + 36 + public function setPostprocessorKey($postprocessor_key) { 37 + $this->postprocessorKey = $postprocessor_key; 38 + return $this; 39 + } 40 + 41 + public function getPostprocessorKey() { 42 + return $this->postprocessorKey; 33 43 } 34 44 35 45 /** ··· 299 309 $use_primary_domain = false) { 300 310 301 311 $uri = $map->getURIForName($name); 312 + 313 + // If we have a postprocessor selected, add it to the URI. 314 + $postprocessor_key = $this->getPostprocessorKey(); 315 + if ($postprocessor_key) { 316 + $uri = preg_replace('@^/res/@', '/res/'.$postprocessor_key.'X/', $uri); 317 + } 302 318 303 319 // In developer mode, we dump file modification times into the URI. When a 304 320 // page is reloaded in the browser, any resources brought in by Ajax calls
+10
src/applications/celerity/__tests__/CelerityPostprocessorTestCase.php
··· 1 + <?php 2 + 3 + final class CelerityPostprocessorTestCase extends PhabricatorTestCase { 4 + 5 + public function testGetAllCelerityPostprocessors() { 6 + CelerityPostprocessor::getAllPostprocessors(); 7 + $this->assertTrue(true); 8 + } 9 + 10 + }
+1
src/applications/celerity/application/PhabricatorCelerityApplication.php
··· 22 22 return array( 23 23 '/res/' => array( 24 24 '(?:(?P<mtime>[0-9]+)T/)?'. 25 + '(?:(?P<postprocessor>[^/]+)X/)?'. 25 26 '(?P<library>[^/]+)/'. 26 27 '(?P<hash>[a-f0-9]{8})/'. 27 28 '(?P<path>.+\.(?:'.$extensions.'))'
+7
src/applications/celerity/controller/CelerityPhabricatorResourceController.php
··· 11 11 private $path; 12 12 private $hash; 13 13 private $library; 14 + private $postprocessorKey; 14 15 15 16 public function getCelerityResourceMap() { 16 17 return CelerityResourceMap::getNamedInstance($this->library); ··· 20 21 $this->path = $data['path']; 21 22 $this->hash = $data['hash']; 22 23 $this->library = $data['library']; 24 + $this->postprocessorKey = idx($data, 'postprocessor'); 23 25 } 24 26 25 27 public function processRequest() { ··· 42 44 43 45 return id(new CelerityResourceTransformer()) 44 46 ->setMinify($should_minify) 47 + ->setPostprocessorKey($this->postprocessorKey) 45 48 ->setCelerityMap($this->getCelerityResourceMap()); 49 + } 50 + 51 + protected function getCacheKey($path) { 52 + return parent::getCacheKey($path.';'.$this->postprocessorKey); 46 53 } 47 54 48 55 }
+1 -1
src/applications/celerity/controller/CelerityResourceController.php
··· 164 164 return isset($types[$type]); 165 165 } 166 166 167 - private function getCacheKey($path) { 167 + protected function getCacheKey($path) { 168 168 return 'celerity:'.PhabricatorHash::digestToLength($path, 64); 169 169 } 170 170
+190
src/applications/celerity/postprocessor/CelerityDefaultPostprocessor.php
··· 1 + <?php 2 + 3 + final class CelerityDefaultPostprocessor 4 + extends CelerityPostprocessor { 5 + 6 + const POSTPROCESSOR_KEY = 'default'; 7 + 8 + public function getPostprocessorKey() { 9 + return self::POSTPROCESSOR_KEY; 10 + } 11 + 12 + public function getPostprocessorName() { 13 + return pht('Use Default Colors'); 14 + } 15 + 16 + public function buildDefaultPostprocessor() { 17 + return null; 18 + } 19 + 20 + public function buildVariables() { 21 + return array( 22 + // Fonts 23 + 'basefont' => "13px 'Segoe UI', 'Segoe UI Web Regular', ". 24 + "'Segoe UI Symbol', 'Lato', 'Helvetica Neue', Helvetica, ". 25 + "Arial, sans-serif", 26 + 27 + 'fontfamily' => "'Segoe UI', 'Segoe UI Web Regular', ". 28 + "'Segoe UI Symbol', 'Lato', 'Helvetica Neue', Helvetica, ". 29 + "Arial, sans-serif", 30 + 31 + // Drop Shadow 32 + 'dropshadow' => '0 1px 6px rgba(0, 0, 0, .25)', 33 + 'whitetextshadow' => '0 1px 0 rgba(255, 255, 255, 1)', 34 + 35 + // Anchors 36 + 'anchor' => '#136CB2', 37 + 38 + // Base Colors 39 + 'red' => '#c0392b', 40 + 'lightred' => '#f4dddb', 41 + 'orange' => '#e67e22', 42 + 'lightorange' => '#f7e2d4', 43 + 'yellow' => '#f1c40f', 44 + 'lightyellow' => '#fdf5d4', 45 + 'green' => '#139543', 46 + 'lightgreen' => '#d7eddf', 47 + 'blue' => '#2980b9', 48 + 'lightblue' => '#daeaf3', 49 + 'sky' => '#3498db', 50 + 'lightsky' => '#ddeef9', 51 + 'fire' => '#e62f17', 52 + 'indigo' => '#6e5cb6', 53 + 'lightindigo' => '#eae6f7', 54 + 'pink' => '#da49be', 55 + 'lightpink' => '#fbeaf8', 56 + 'violet' => '#8e44ad', 57 + 'lightviolet' => '#ecdff1', 58 + 'charcoal' => '#4b4d51', 59 + 'backdrop' => '#dadee7', 60 + 'hoverwhite' => 'rgba(255,255,255,.6)', 61 + 'hovergrey' => '#c5cbcf', 62 + 'hoverblue' => '#eceff5', 63 + 'hoverborder' => '#dfe1e9', 64 + 'hoverselectedgrey' => '#bbc4ca', 65 + 'hoverselectedblue' => '#e6e9ee', 66 + 'borderinset' => 'inset 0 0 0 1px rgba(55,55,55,.15)', 67 + 68 + // Base Greys 69 + 'lightgreyborder' => '#C7CCD9', 70 + 'greyborder' => '#A1A6B0', 71 + 'darkgreyborder' => '#676A70', 72 + 'lightgreytext' => '#92969D', 73 + 'greytext' => '#74777D', 74 + 'darkgreytext' => '#4B4D51', 75 + 'lightgreybackground' => '#F7F7F7', 76 + 'greybackground' => '#EBECEE', 77 + 'darkgreybackground' => '#DFE0E2', 78 + 79 + // Base Blues 80 + 'thinblueborder' => '#DDE8EF', 81 + 'lightblueborder' => '#BFCFDA', 82 + 'blueborder' => '#8C98B8', 83 + 'darkblueborder' => '#626E82', 84 + 'lightbluebackground' => '#F8F9FC', 85 + 'bluebackground' => '#DAE7FF', 86 + 'lightbluetext' => '#8C98B8', 87 + 'bluetext' => '#6B748C', 88 + 'darkbluetext' => '#464C5C', 89 + 90 + // Base Greens 91 + 'lightgreenborder' => '#bfdac1', 92 + 'greenborder' => '#8cb89c', 93 + 'greentext' => '#3e6d35', 94 + 'lightgreenbackground' => '#e6f2e4', 95 + 96 + // Base Red 97 + 'lightredborder' => '#f4c6c6', 98 + 'redborder' => '#eb9797', 99 + 'redtext' => '#802b2b', 100 + 'lightredbackground' => '#f5e1e1', 101 + 102 + // Base Violet 103 + 'lightvioletborder' => '#cfbddb', 104 + 'violetborder' => '#b589ba', 105 + 'violettext' => '#603c73', 106 + 'lightvioletbackground' => '#e9dfee', 107 + 108 + // Shades are a more muted set of our base colors 109 + // better suited to blending into other UIs. 110 + 111 + // Shade Red 112 + 'sh-lightredborder' => '#efcfcf', 113 + 'sh-redborder' => '#d1abab', 114 + 'sh-redicon' => '#c85a5a', 115 + 'sh-redtext' => '#a53737', 116 + 'sh-redbackground' => '#f7e6e6', 117 + 118 + // Shade Orange 119 + 'sh-lightorangeborder' => '#f8dcc3', 120 + 'sh-orangeborder' => '#dbb99e', 121 + 'sh-orangeicon' => '#e78331', 122 + 'sh-orangetext' => '#ba6016', 123 + 'sh-orangebackground' => '#fbede1', 124 + 125 + // Shade Yellow 126 + 'sh-lightyellowborder' => '#e9dbcd', 127 + 'sh-yellowborder' => '#c9b8a8', 128 + 'sh-yellowicon' => '#9b946e', 129 + 'sh-yellowtext' => '#726f56', 130 + 'sh-yellowbackground' => '#fdf3da', 131 + 132 + // Shade Green 133 + 'sh-lightgreenborder' => '#c6e6c7', 134 + 'sh-greenborder' => '#a0c4a1', 135 + 'sh-greenicon' => '#4ca74e', 136 + 'sh-greentext' => '#326d34', 137 + 'sh-greenbackground' => '#ddefdd', 138 + 139 + // Shade Blue 140 + 'sh-lightblueborder' => '#cfdbe3', 141 + 'sh-blueborder' => '#a7b5bf', 142 + 'sh-blueicon' => '#6b748c', 143 + 'sh-bluetext' => '#464c5c', 144 + 'sh-bluebackground' => '#dee7f8', 145 + 146 + // Shade Indigo 147 + 'sh-lightindigoborder' => '#d1c9ee', 148 + 'sh-indigoborder' => '#bcb4da', 149 + 'sh-indigoicon' => '#8672d4', 150 + 'sh-indigotext' => '#6e5cb6', 151 + 'sh-indigobackground' => '#eae6f7', 152 + 153 + // Shade Violet 154 + 'sh-lightvioletborder' => '#e0d1e7', 155 + 'sh-violetborder' => '#bcabc5', 156 + 'sh-violeticon' => '#9260ad', 157 + 'sh-violettext' => '#69427f', 158 + 'sh-violetbackground' => '#efe8f3', 159 + 160 + // Shade Pink 161 + 'sh-lightpinkborder' => '#f6d5ef', 162 + 'sh-pinkborder' => '#d5aecd', 163 + 'sh-pinkicon' => '#e26fcb', 164 + 'sh-pinktext' => '#da49be', 165 + 'sh-pinkbackground' => '#fbeaf8', 166 + 167 + // Shade Grey 168 + 'sh-lightgreyborder' => '#d8d8d8', 169 + 'sh-greyborder' => '#b2b2b2', 170 + 'sh-greyicon' => '#757575', 171 + 'sh-greytext' => '#555555', 172 + 'sh-greybackground' => '#e7e7e7', 173 + 174 + // Shade Disabled 175 + 'sh-lightdisabledborder' => '#e5e5e5', 176 + 'sh-disabledborder' => '#cbcbcb', 177 + 'sh-disabledicon' => '#bababa', 178 + 'sh-disabledtext' => '#a6a6a6', 179 + 'sh-disabledbackground' => '#f3f3f3', 180 + 181 + // Background color for "light" themes. 182 + 'page.background.light' => '#f7f7f7', 183 + 184 + // Background color for "dark" themes. 185 + 'page.background.dark' => '#ebecee', 186 + 187 + ); 188 + } 189 + 190 + }
+27
src/applications/celerity/postprocessor/CelerityHighContrastPostprocessor.php
··· 1 + <?php 2 + 3 + final class CelerityHighContrastPostprocessor 4 + extends CelerityPostprocessor { 5 + 6 + public function getPostprocessorKey() { 7 + return 'contrast'; 8 + } 9 + 10 + public function getPostprocessorName() { 11 + return pht('Use High Contrast Colors'); 12 + } 13 + 14 + public function buildVariables() { 15 + return array( 16 + 'page.background.light' => '#dfdfdf', 17 + 'page.background.dark' => '#dfdfdf', 18 + 19 + 'lightblueborder' => '#000099', 20 + 'blueborder' => '#000066', 21 + 22 + 'lightbluetext' => '#333366', 23 + 'bluetext' => '#222244', 24 + ); 25 + } 26 + 27 + }
+69
src/applications/celerity/postprocessor/CelerityPostprocessor.php
··· 1 + <?php 2 + 3 + abstract class CelerityPostprocessor 4 + extends Phobject { 5 + 6 + private $default; 7 + 8 + abstract public function getPostprocessorKey(); 9 + abstract public function getPostprocessorName(); 10 + abstract public function buildVariables(); 11 + 12 + public function buildDefaultPostprocessor() { 13 + return new CelerityDefaultPostprocessor(); 14 + } 15 + 16 + final public function getVariables() { 17 + $variables = $this->buildVariables(); 18 + 19 + $default = $this->getDefault(); 20 + if ($default) { 21 + $variables += $default->getVariables(); 22 + } 23 + 24 + return $variables; 25 + } 26 + 27 + final public function getDefault() { 28 + if ($this->default === null) { 29 + $this->default = $this->buildDefaultPostprocessor(); 30 + } 31 + return $this->default; 32 + } 33 + 34 + final public static function getPostprocessor($key) { 35 + return idx(self::getAllPostprocessors(), $key); 36 + } 37 + 38 + final public static function getAllPostprocessors() { 39 + static $postprocessors; 40 + 41 + if ($postprocessors === null) { 42 + $objects = id(new PhutilSymbolLoader()) 43 + ->setAncestorClass(__CLASS__) 44 + ->loadObjects(); 45 + 46 + $map = array(); 47 + foreach ($objects as $object) { 48 + $key = $object->getPostprocessorKey(); 49 + if (empty($map[$key])) { 50 + $map[$key] = $object; 51 + continue; 52 + } 53 + 54 + throw new Exception( 55 + pht( 56 + 'Two postprocessors (of classes "%s" and "%s") define the same '. 57 + 'postprocessor key ("%s"). Each postprocessor must define a '. 58 + 'unique key.', 59 + get_class($object), 60 + get_class($map[$key]), 61 + $key)); 62 + } 63 + $postprocessors = $map; 64 + } 65 + 66 + return $postprocessors; 67 + } 68 + 69 + }
+3 -1
src/applications/files/controller/PhabricatorFileComposeController.php
··· 322 322 private function composeImage($color, $icon_data) { 323 323 $icon_img = imagecreatefromstring($icon_data); 324 324 325 - $map = CelerityResourceTransformer::getCSSVariableMap(); 325 + $map = id(new CelerityResourceTransformer()) 326 + ->getCSSVariableMap(); 327 + 326 328 $color_string = idx($map, $color, '#ff00ff'); 327 329 $color_const = hexdec(trim($color_string, '#')); 328 330
+22
src/applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php
··· 25 25 $pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES; 26 26 $pref_monospaced_textareas = 27 27 PhabricatorUserPreferences::PREFERENCE_MONOSPACED_TEXTAREAS; 28 + $pref_postprocessor = 29 + PhabricatorUserPreferences::PREFERENCE_RESOURCE_POSTPROCESSOR; 28 30 29 31 $errors = array(); 30 32 $e_editor = null; ··· 42 44 $preferences->setPreference( 43 45 $pref_monospaced_textareas, 44 46 $request->getStr($pref_monospaced_textareas)); 47 + $preferences->setPreference( 48 + $pref_postprocessor, 49 + $request->getStr($pref_postprocessor)); 45 50 46 51 $editor_pattern = $preferences->getPreference($pref_editor); 47 52 if (strlen($editor_pattern)) { ··· 106 111 'Input should be valid CSS "font" declaration, such as '. 107 112 '"13px Consolas"'); 108 113 114 + $postprocessor_map = CelerityPostprocessor::getAllPostprocessors(); 115 + $postprocessor_map = mpull($postprocessor_map, 'getPostprocessorName'); 116 + asort($postprocessor_map); 117 + $postprocessor_order = array( 118 + CelerityDefaultPostprocessor::POSTPROCESSOR_KEY, 119 + ); 120 + 121 + $postprocessor_map = array_select_keys( 122 + $postprocessor_map, 123 + $postprocessor_order) + $postprocessor_map; 124 + 109 125 $form = id(new AphrontFormView()) 110 126 ->setUser($user) 127 + ->appendControl( 128 + id(new AphrontFormSelectControl()) 129 + ->setLabel(pht('Accessibility')) 130 + ->setName($pref_postprocessor) 131 + ->setValue($preferences->getPreference($pref_postprocessor)) 132 + ->setOptions($postprocessor_map)) 111 133 ->appendChild( 112 134 id(new AphrontFormSelectControl()) 113 135 ->setLabel(pht('Page Titles'))
+2
src/applications/settings/storage/PhabricatorUserPreferences.php
··· 38 38 const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications'; 39 39 const PREFERENCE_CONPHERENCE_COLUMN = 'conpherence-column'; 40 40 41 + const PREFERENCE_RESOURCE_POSTPROCESSOR = 'resource-postprocessor'; 42 + 41 43 // These are in an unusual order for historic reasons. 42 44 const MAILTAG_PREFERENCE_NOTIFY = 0; 43 45 const MAILTAG_PREFERENCE_EMAIL = 1;
+11
src/view/page/PhabricatorBarePageView.php
··· 117 117 118 118 $response = CelerityAPI::getStaticResourceResponse(); 119 119 120 + if ($this->getRequest()) { 121 + $viewer = $this->getRequest()->getViewer(); 122 + if ($viewer) { 123 + $postprocessor_key = $viewer->getPreference( 124 + PhabricatorUserPreferences::PREFERENCE_RESOURCE_POSTPROCESSOR); 125 + if (strlen($postprocessor_key)) { 126 + $response->setPostProcessorKey($postprocessor_key); 127 + } 128 + } 129 + } 130 + 120 131 $developer = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); 121 132 return hsprintf( 122 133 '%s%s%s%s%s%s%s%s',
+1 -1
webroot/rsrc/css/application/base/main-menu-view.css
··· 17 17 18 18 .phabricator-main-menu-background { 19 19 min-height: 43px; 20 - background: #ebecee; 20 + background-color: #ebecee; 21 21 border-bottom: 1px solid rgba(0,0,0,.1); 22 22 } 23 23
+1 -1
webroot/rsrc/css/application/base/phui-theme.css
··· 75 75 /*--- Dark "Classic" ---------------------------------------------------------*/ 76 76 77 77 .phui-theme-dark { 78 - background-color: #ebecee; 78 + background-color: {$page.background.dark}; 79 79 } 80 80 81 81 .phui-theme-dark .phui-box-border {
+1 -1
webroot/rsrc/css/core/core.css
··· 47 47 direction: ltr; 48 48 text-align: left; 49 49 unicode-bidi: embed; 50 - background: {$lightgreybackground}; 50 + background: {$page.background.light}; 51 51 52 52 /* By default, the iPhone zooms all text on the page by some percentage when 53 53 you rotate from portrait mode to landscape mode. Disable this, since it