2012-11-24 01:35:39 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class CeleritySpriteGenerator {
|
|
|
|
|
|
|
|
public function buildIconSheet() {
|
|
|
|
$icons = $this->getDirectoryList('icons_1x');
|
|
|
|
|
|
|
|
$colors = array(
|
|
|
|
'',
|
|
|
|
'grey',
|
|
|
|
'white',
|
|
|
|
);
|
|
|
|
|
|
|
|
$scales = array(
|
|
|
|
'1x' => 1,
|
|
|
|
'2x' => 2,
|
|
|
|
);
|
|
|
|
|
|
|
|
$template = id(new PhutilSprite())
|
|
|
|
->setSourceSize(14, 14);
|
|
|
|
|
|
|
|
$sprites = array();
|
|
|
|
foreach ($colors as $color) {
|
|
|
|
foreach ($icons as $icon) {
|
|
|
|
$prefix = 'icons_';
|
|
|
|
if (strlen($color)) {
|
|
|
|
$prefix .= $color.'_';
|
|
|
|
}
|
|
|
|
|
|
|
|
$suffix = '';
|
|
|
|
if (strlen($color)) {
|
|
|
|
$suffix = '-'.$color;
|
|
|
|
}
|
|
|
|
|
|
|
|
$sprite = id(clone $template)
|
|
|
|
->setName('action-'.$icon.$suffix);
|
|
|
|
|
|
|
|
if ($color == 'white') {
|
|
|
|
$sprite->setTargetCSS(
|
2012-12-11 22:59:35 +01:00
|
|
|
'.action-'.$icon.$suffix.', '.
|
2012-11-24 01:35:39 +01:00
|
|
|
'.device-desktop .phabricator-action-view:hover .action-'.$icon);
|
|
|
|
} else {
|
|
|
|
$sprite->setTargetCSS('.action-'.$icon.$suffix);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($scales as $scale_key => $scale) {
|
|
|
|
$path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png');
|
|
|
|
$sprite->setSourceFile($path, $scale);
|
|
|
|
}
|
|
|
|
$sprites[] = $sprite;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$remarkup_icons = $this->getDirectoryList('remarkup_1x');
|
|
|
|
foreach ($remarkup_icons as $icon) {
|
|
|
|
$prefix = 'remarkup_';
|
|
|
|
|
|
|
|
// Strip 'text_' from these file names.
|
|
|
|
$class_name = substr($icon, 5);
|
|
|
|
|
|
|
|
$sprite = id(clone $template)
|
|
|
|
->setName('remarkup-assist-'.$icon)
|
|
|
|
->setTargetCSS('.remarkup-assist-'.$class_name);
|
|
|
|
foreach ($scales as $scale_key => $scale) {
|
|
|
|
$path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png');
|
|
|
|
$sprite->setSourceFile($path, $scale);
|
|
|
|
}
|
|
|
|
$sprites[] = $sprite;
|
|
|
|
}
|
|
|
|
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 22:37:28 +01:00
|
|
|
$sheet = $this->buildSheet('icon', true);
|
2012-11-24 01:35:39 +01:00
|
|
|
$sheet->setScales($scales);
|
|
|
|
foreach ($sprites as $sprite) {
|
|
|
|
$sheet->addSprite($sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $sheet;
|
|
|
|
}
|
|
|
|
|
2012-11-27 23:03:25 +01:00
|
|
|
public function buildMenuSheet() {
|
|
|
|
$sprites = array();
|
|
|
|
|
|
|
|
$sources = array(
|
|
|
|
'round_bubble' => array(
|
|
|
|
'x' => 26,
|
|
|
|
'y' => 26,
|
|
|
|
'css' => '.phabricator-main-menu-alert-bubble'
|
|
|
|
),
|
|
|
|
'bubble' => array(
|
|
|
|
'x' => 46,
|
|
|
|
'y' => 26,
|
|
|
|
'css' => '.phabricator-main-menu-alert-bubble.alert-unread'
|
|
|
|
),
|
|
|
|
'seen_read_all' => array(
|
|
|
|
'x' => 14,
|
|
|
|
'y' => 14,
|
|
|
|
'css' =>
|
|
|
|
'.alert-notifications .phabricator-main-menu-alert-icon',
|
|
|
|
),
|
|
|
|
'seen_have_unread' => array(
|
|
|
|
'x' => 14,
|
|
|
|
'y' => 14,
|
|
|
|
'css' =>
|
|
|
|
'.alert-notifications:hover .phabricator-main-menu-alert-icon',
|
|
|
|
),
|
|
|
|
'unseen_any' => array(
|
|
|
|
'x' => 14,
|
|
|
|
'y' => 14,
|
|
|
|
'css' =>
|
|
|
|
'.alert-notifications.alert-unread .phabricator-main-menu-alert-icon',
|
|
|
|
),
|
2012-12-07 22:35:49 +01:00
|
|
|
'arrow-right' => array(
|
|
|
|
'x' => 9,
|
|
|
|
'y' => 31,
|
|
|
|
'css' => '.phabricator-crumb-divider',
|
|
|
|
),
|
2012-12-07 22:36:35 +01:00
|
|
|
'eye' => array(
|
|
|
|
'x' => 24,
|
|
|
|
'y' => 20,
|
|
|
|
'css' => '.menu-icon-eye',
|
|
|
|
),
|
|
|
|
'app' => array(
|
|
|
|
'x' => 24,
|
|
|
|
'y' => 20,
|
|
|
|
'css' => '.menu-icon-app',
|
|
|
|
),
|
2012-12-07 23:29:09 +01:00
|
|
|
'logo' => array(
|
|
|
|
'x' => 139,
|
|
|
|
'y' => 25,
|
|
|
|
'css' => '.phabricator-main-menu-logo-image',
|
|
|
|
),
|
2012-11-27 23:03:25 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
$scales = array(
|
|
|
|
'1x' => 1,
|
|
|
|
'2x' => 2,
|
|
|
|
);
|
|
|
|
|
|
|
|
$template = new PhutilSprite();
|
|
|
|
foreach ($sources as $name => $spec) {
|
|
|
|
$sprite = id(clone $template)
|
|
|
|
->setName($name)
|
|
|
|
->setSourceSize($spec['x'], $spec['y'])
|
|
|
|
->setTargetCSS($spec['css']);
|
|
|
|
|
|
|
|
foreach ($scales as $scale_name => $scale) {
|
2012-12-07 22:35:49 +01:00
|
|
|
$path = 'menu_'.$scale_name.'/'.$name.'.png';
|
2012-11-27 23:03:25 +01:00
|
|
|
$path = $this->getPath($path);
|
|
|
|
|
|
|
|
$sprite->setSourceFile($path, $scale);
|
|
|
|
}
|
|
|
|
$sprites[] = $sprite;
|
|
|
|
}
|
|
|
|
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 22:37:28 +01:00
|
|
|
$sheet = $this->buildSheet('menu', true);
|
2012-11-27 23:03:25 +01:00
|
|
|
$sheet->setScales($scales);
|
|
|
|
foreach ($sprites as $sprite) {
|
|
|
|
$sheet->addSprite($sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $sheet;
|
|
|
|
}
|
|
|
|
|
2012-12-07 22:35:49 +01:00
|
|
|
public function buildGradientSheet() {
|
|
|
|
$gradients = $this->getDirectoryList('gradients');
|
|
|
|
|
|
|
|
$template = new PhutilSprite();
|
|
|
|
|
|
|
|
$unusual_heights = array(
|
|
|
|
'dark-menu-label' => 25,
|
|
|
|
'breadcrumbs' => 31,
|
2013-01-16 00:49:48 +01:00
|
|
|
'menu-hover' => 28,
|
|
|
|
'menu-label' => 24,
|
|
|
|
'menu-selected' => 28,
|
2012-12-07 22:35:49 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
// Reorder the sprites so less-specific rules generate earlier in the sheet.
|
|
|
|
// Otherwise we end up with blue "a.black" buttons because the blue rules
|
|
|
|
// have the same specificity but appear later.
|
|
|
|
$gradients = array_combine($gradients, $gradients);
|
|
|
|
$gradients = array_select_keys(
|
|
|
|
$gradients,
|
|
|
|
array(
|
|
|
|
'blue-dark',
|
|
|
|
'blue-light',
|
|
|
|
)) + $gradients;
|
|
|
|
|
|
|
|
$extra_css = array(
|
|
|
|
'black-dark' => ', button.black, a.black, a.black:visited',
|
|
|
|
'black-light' => ', button.black:active, a.black:active',
|
|
|
|
'blue-dark' => ', button, a.button, a.button:visited, input.inputsubmit',
|
|
|
|
'blue-light' => ', button:active, a.button:active',
|
|
|
|
'grey-dark' => ', button.grey, input.inputaux, a.grey, a.grey:visited, '.
|
|
|
|
'a.button.disabled, button[disabled], button.disabled',
|
|
|
|
'grey-light' => ', button.grey:active, a.grey:active, '.
|
|
|
|
'button.grey_active, a.dropdown-open',
|
|
|
|
'green-dark' => ', button.green, a.green, a.green:visited',
|
|
|
|
'green-light' => ', button.green:active, a.green:active',
|
2013-01-16 00:49:48 +01:00
|
|
|
'dark-menu-label' =>
|
|
|
|
', .phabricator-dark-menu .phabricator-menu-item-type-label',
|
|
|
|
'menu-label' =>
|
|
|
|
', .phabricator-side-menu .phabricator-menu-item-type-label',
|
|
|
|
'menu-hover' =>
|
|
|
|
', .device-desktop .phabricator-side-menu '.
|
2013-01-22 18:09:57 +01:00
|
|
|
'a.phabricator-menu-item-type-link:hover, '.
|
|
|
|
'.phabricator-filetree a.phabricator-filetree-item:hover',
|
2013-01-16 00:49:48 +01:00
|
|
|
'menu-selected' =>
|
|
|
|
', .phabricator-side-menu .phabricator-menu-item-selected, '.
|
|
|
|
'.device-desktop .phabricator-side-menu '.
|
2013-01-22 18:09:57 +01:00
|
|
|
'a.phabricator-menu-item-selected:hover, '.
|
|
|
|
'.phabricator-nav-local a.phabricator-active-nav-focus',
|
2012-12-07 22:35:49 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
$sprites = array();
|
|
|
|
foreach ($gradients as $gradient) {
|
|
|
|
$path = $this->getPath('gradients/'.$gradient.'.png');
|
|
|
|
$sprite = id(clone $template)
|
|
|
|
->setName('gradient-'.$gradient)
|
|
|
|
->setSourceFile($path)
|
|
|
|
->setTargetCSS('.gradient-'.$gradient.idx($extra_css, $gradient));
|
|
|
|
|
|
|
|
$sprite->setSourceSize(4, idx($unusual_heights, $gradient, 26));
|
|
|
|
|
|
|
|
$sprites[] = $sprite;
|
|
|
|
}
|
|
|
|
|
|
|
|
$sheet = $this->buildSheet(
|
|
|
|
'gradient',
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 22:37:28 +01:00
|
|
|
false,
|
2012-12-07 22:35:49 +01:00
|
|
|
PhutilSpriteSheet::TYPE_REPEAT_X,
|
2012-12-07 22:36:35 +01:00
|
|
|
', button, a.button, a.button:visited, input.inputsubmit, '.
|
2013-01-16 00:49:48 +01:00
|
|
|
'.phabricator-dark-menu .phabricator-menu-item-type-label, '.
|
|
|
|
'.phabricator-side-menu .phabricator-menu-item-type-label, '.
|
|
|
|
'.device-desktop .phabricator-side-menu '.
|
|
|
|
'a.phabricator-menu-item-type-link:hover, '.
|
|
|
|
'.phabricator-side-menu .phabricator-menu-item-selected, '.
|
|
|
|
'.device-desktop .phabricator-side-menu '.
|
2013-01-22 18:09:57 +01:00
|
|
|
'a.phabricator-menu-item-selected:hover, '.
|
|
|
|
'.phabricator-filetree a.phabricator-filetree-item:hover, '.
|
|
|
|
'.phabricator-filetree a.phabricator-active-nav-focus');
|
2012-12-07 22:35:49 +01:00
|
|
|
foreach ($sprites as $sprite) {
|
|
|
|
$sheet->addSprite($sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $sheet;
|
|
|
|
}
|
|
|
|
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 22:37:28 +01:00
|
|
|
public function buildAppsSheet() {
|
|
|
|
return $this->buildAppsSheetVariant(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildAppsLargeSheet() {
|
|
|
|
return $this->buildAppsSheetVariant(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildAppsXLargeSheet() {
|
|
|
|
return $this->buildAppsSheetVariant(3);
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildAppsSheetVariant($variant) {
|
|
|
|
|
|
|
|
if ($variant == 1) {
|
|
|
|
$scales = array(
|
|
|
|
'1x' => 1,
|
|
|
|
'2x' => 2,
|
|
|
|
);
|
|
|
|
$variant_name = 'apps';
|
|
|
|
$variant_short = '';
|
|
|
|
$size_x = 14;
|
|
|
|
$size_y = 14;
|
|
|
|
|
|
|
|
$colors = array(
|
|
|
|
'dark' => 'dark',
|
|
|
|
);
|
|
|
|
} else if ($variant == 2) {
|
|
|
|
$scales = array(
|
|
|
|
'2x' => 1,
|
|
|
|
'4x' => 2,
|
|
|
|
);
|
|
|
|
$variant_name = 'apps-large';
|
|
|
|
$variant_short = '-large';
|
|
|
|
$size_x = 28;
|
|
|
|
$size_y = 28;
|
|
|
|
|
|
|
|
$colors = array(
|
|
|
|
'light' => 'lb',
|
|
|
|
'dark' => 'dark',
|
|
|
|
'blue' => 'blue',
|
|
|
|
'glow' => 'glow',
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$scales = array(
|
|
|
|
'4x' => 1,
|
|
|
|
);
|
|
|
|
$variant_name = 'apps-xlarge';
|
|
|
|
$variant_short = '-xlarge';
|
|
|
|
$size_x = 56;
|
|
|
|
$size_y = 56;
|
|
|
|
|
|
|
|
$colors = array(
|
|
|
|
'dark' => 'dark',
|
|
|
|
/*
|
|
|
|
|
|
|
|
TODO: These are available but not currently used.
|
|
|
|
|
|
|
|
'blue' => 'blue',
|
|
|
|
'light' => 'lb',
|
|
|
|
'glow' => 'glow',
|
|
|
|
*/
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$apps = $this->getDirectoryList('apps_dark_1x');
|
|
|
|
|
|
|
|
$template = id(new PhutilSprite())
|
|
|
|
->setSourceSize($size_x, $size_y);
|
|
|
|
|
|
|
|
$sprites = array();
|
|
|
|
foreach ($apps as $app) {
|
|
|
|
foreach ($colors as $color => $color_path) {
|
|
|
|
|
|
|
|
$css = '.app-'.$app.'-'.$color.$variant_short;
|
|
|
|
if ($color == 'blue' && $variant_name == 'apps-large') {
|
|
|
|
$css .= ', .phabricator-crumb-view:hover .app-'.$app.'-dark-large';
|
|
|
|
}
|
|
|
|
if ($color == 'glow' && $variant_name == 'apps-large') {
|
|
|
|
$css .= ', .device-desktop .phabricator-dark-menu a:hover '.
|
|
|
|
'.app-'.$app.'-light-large';
|
|
|
|
}
|
|
|
|
|
|
|
|
$sprite = id(clone $template)
|
|
|
|
->setName('app-'.$app.'-'.$color.$variant_short)
|
|
|
|
->setTargetCSS($css);
|
|
|
|
|
|
|
|
foreach ($scales as $scale_name => $scale) {
|
|
|
|
$path = $this->getPath(
|
|
|
|
'apps_'.$color_path.'_'.$scale_name.'/'.$app.'.png');
|
|
|
|
$sprite->setSourceFile($path, $scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
$sprites[] = $sprite;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$sheet = $this->buildSheet($variant_name, count($scales) > 1);
|
|
|
|
$sheet->setScales($scales);
|
|
|
|
foreach ($sprites as $sprite) {
|
|
|
|
$sheet->addSprite($sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $sheet;
|
|
|
|
}
|
|
|
|
|
2012-12-07 22:35:49 +01:00
|
|
|
|
2012-11-24 01:35:39 +01:00
|
|
|
private function getPath($to_path = null) {
|
|
|
|
$root = dirname(phutil_get_library_root('phabricator'));
|
|
|
|
return $root.'/resources/sprite/'.$to_path;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function getDirectoryList($dir) {
|
|
|
|
$path = $this->getPath($dir);
|
|
|
|
|
|
|
|
$result = array();
|
|
|
|
|
|
|
|
$images = Filesystem::listDirectory($path, $include_hidden = false);
|
|
|
|
foreach ($images as $image) {
|
|
|
|
if (!preg_match('/\.png$/', $image)) {
|
|
|
|
throw new Exception(
|
|
|
|
"Expected file '{$image}' in '{$path}' to be a sprite source ".
|
|
|
|
"ending in '.png'.");
|
|
|
|
}
|
|
|
|
$result[] = substr($image, 0, -4);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 22:37:28 +01:00
|
|
|
private function buildSheet(
|
|
|
|
$name,
|
|
|
|
$has_retina,
|
|
|
|
$type = null,
|
|
|
|
$extra_css = '') {
|
|
|
|
|
2012-11-24 01:35:39 +01:00
|
|
|
$sheet = new PhutilSpriteSheet();
|
|
|
|
|
|
|
|
$at = '@';
|
2012-12-07 22:35:49 +01:00
|
|
|
|
|
|
|
switch ($type) {
|
|
|
|
case PhutilSpriteSheet::TYPE_STANDARD:
|
|
|
|
default:
|
|
|
|
$type = PhutilSpriteSheet::TYPE_STANDARD;
|
|
|
|
$repeat_rule = 'no-repeat';
|
|
|
|
break;
|
|
|
|
case PhutilSpriteSheet::TYPE_REPEAT_X:
|
|
|
|
$repeat_rule = 'repeat-x';
|
|
|
|
break;
|
|
|
|
case PhutilSpriteSheet::TYPE_REPEAT_Y:
|
|
|
|
$repeat_rule = 'repeat-y';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 22:37:28 +01:00
|
|
|
$retina_rules = null;
|
|
|
|
if ($has_retina) {
|
|
|
|
$retina_rules = <<<EOCSS
|
|
|
|
@media
|
|
|
|
only screen and (min-device-pixel-ratio: 1.5),
|
|
|
|
only screen and (-webkit-min-device-pixel-ratio: 1.5) {
|
|
|
|
.sprite-{$name}{$extra_css} {
|
|
|
|
background-image: url(/rsrc/image/sprite-{$name}-X2.png);
|
|
|
|
background-size: {X}px {Y}px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOCSS;
|
|
|
|
}
|
|
|
|
|
2012-12-07 22:35:49 +01:00
|
|
|
$sheet->setSheetType($type);
|
2012-11-24 01:35:39 +01:00
|
|
|
$sheet->setCSSHeader(<<<EOCSS
|
|
|
|
/**
|
|
|
|
* @provides sprite-{$name}-css
|
|
|
|
* {$at}generated
|
|
|
|
*/
|
|
|
|
|
2012-12-07 22:35:49 +01:00
|
|
|
.sprite-{$name}{$extra_css} {
|
2012-11-24 01:35:39 +01:00
|
|
|
background-image: url(/rsrc/image/sprite-{$name}.png);
|
2012-12-07 22:35:49 +01:00
|
|
|
background-repeat: {$repeat_rule};
|
2012-11-24 01:35:39 +01:00
|
|
|
}
|
|
|
|
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 22:37:28 +01:00
|
|
|
{$retina_rules}
|
|
|
|
|
2012-11-24 01:35:39 +01:00
|
|
|
EOCSS
|
|
|
|
);
|
|
|
|
|
|
|
|
return $sheet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|