Skip to content

Commit 0527344

Browse files
committed
bug symfony#17109 Improved the design of the web debug toolbar (javiereguiluz)
This PR was squashed before being merged into the 2.8 branch (closes symfony#17109). Discussion ---------- Improved the design of the web debug toolbar | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This PR contains three little improvements: ## 1) Icon size Somehow, the size of the icons wasn't limited properly. This makes them appear too big and unaligns text vertically: ### Before ![before_icon_size](https://cloud.githubusercontent.com/assets/73419/11956693/5dce6432-a8bc-11e5-9726-958bbf95e945.png) ### After ![after_icon_size](https://cloud.githubusercontent.com/assets/73419/11956696/5faba396-a8bc-11e5-8453-6d9601803335.png) ## 2) Status blocks It's very common to have single-digit and double-digit status blocks in some panels. Now they show a different width: ![before_status_1](https://cloud.githubusercontent.com/assets/73419/11956743/affd180c-a8bc-11e5-8c53-044b60dad53e.png) ![before_status_2](https://cloud.githubusercontent.com/assets/73419/11956744/b0ed99c6-a8bc-11e5-83d6-7a926e780d14.png) Now we set a minimum-width that looks good for single and double digit values: ![after_status_1](https://cloud.githubusercontent.com/assets/73419/11956766/dff29758-a8bc-11e5-9eea-f6204acb2794.png) ![after_status_2](https://cloud.githubusercontent.com/assets/73419/11956768/e1af5f68-a8bc-11e5-8d07-e6219a667529.png) Although this solution doesn't solve the case when some block displays three digits, I think we can safely ignore that edge case. ## 3) Colors The green/yellow/red colors of the toolbar were different from the green/yellow/red colors of the profiler. The reason is that we designed the toolbar first and separately from the profiler. The second (minor) issue is that green and yellow didn't have enough contrast (they didn't pass the WCAG accessibility check). So I propose to slightly change the green and yellow colors and to use the same colors in the toolbar and the profiler. ### Toolbar Before ![before_colors](https://cloud.githubusercontent.com/assets/73419/11956842/83e1c618-a8bd-11e5-9ac0-b97de8e70ec3.png) ### Toolbar After ![after_colors](https://cloud.githubusercontent.com/assets/73419/11956844/86759af8-a8bd-11e5-83c5-7ce2f74d4b88.png) ### Profiler Before ![before_profiler_success](https://cloud.githubusercontent.com/assets/73419/11956864/c21889a8-a8bd-11e5-95ee-8d6103b6a26c.png) ![before_profiler_warning](https://cloud.githubusercontent.com/assets/73419/11956866/c3240e62-a8bd-11e5-8797-de3481dd40a0.png) ![before_profiler_error](https://cloud.githubusercontent.com/assets/73419/11956867/c4d7b25e-a8bd-11e5-9e7a-6519b34009de.png) ### Profiler After ![after_profiler_success](https://cloud.githubusercontent.com/assets/73419/11956887/ea5ceabc-a8bd-11e5-8373-492e838148ea.png) ![after_profiler_warning](https://cloud.githubusercontent.com/assets/73419/11956888/eb3bf284-a8bd-11e5-8be6-93a91ed2ae0e.png) ![after_profiler_error](https://cloud.githubusercontent.com/assets/73419/11956889/ed057b4e-a8bd-11e5-9533-a807d8547843.png) The new colors pass the accessibility requirements: ![color_accessibility_success](https://cloud.githubusercontent.com/assets/73419/11956894/03ccbd60-a8be-11e5-96d2-727bb9b62dc7.png) ![color_accessibility_warning](https://cloud.githubusercontent.com/assets/73419/11956896/04d893f0-a8be-11e5-8c18-9515f624974a.png) ![color_accessibility_error](https://cloud.githubusercontent.com/assets/73419/11956899/06cbc524-a8be-11e5-8622-e2b60da1c8b2.png) Commits ------- 9859125 Improved the design of the web debug toolbar
2 parents 352049c + 9859125 commit 0527344

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
'subtle_border_and_shadow': 'background: #FFF; border: 1px solid #E0E0E0; box-shadow: 0px 0px 1px rgba(128, 128, 128, .2);'
88
} %}
99

10+
{# when updating any of these colors, do the same in toolbar.css.twig #}
11+
{% set colors = { 'success': '#4F805D', 'warning': '#A46A1F', 'error': '#B0413E' } %}
12+
1013
{# Normalization
1114
(normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css)
1215
========================================================================= #}
@@ -232,9 +235,9 @@ table tbody ul {
232235
padding: 3px 7px;
233236
white-space: nowrap;
234237
}
235-
.label.status-success { background: #5E976E; color: #FFF; }
236-
.label.status-warning { background: #BC8034; color: #FFF; }
237-
.label.status-error { background: #B0413E; color: #FFF; }
238+
.label.status-success { background: {{ colors.success|raw }}; color: #FFF; }
239+
.label.status-warning { background: {{ colors.warning|raw }}; color: #FFF; }
240+
.label.status-error { background: {{ colors.error|raw }}; color: #FFF; }
238241

239242
{# Metrics
240243
------------------------------------------------------------------------- #}
@@ -341,11 +344,11 @@ tr.status-warning td {
341344
border-top: 1px solid #FAFAFA;
342345
}
343346

344-
.status-warning .colored {
345-
color: #BC8034;
347+
.status-warning .colored {
348+
color: {{ colors.warning|raw }};
346349
}
347350
.status-error .colored {
348-
color: #B0413E;
351+
color: {{ colors.error|raw }};
349352
}
350353

351354
{# Syntax highlighting
@@ -469,9 +472,9 @@ tr.status-warning td {
469472
text-decoration: underline;
470473
}
471474

472-
#summary .status-success { background: #5E976E; }
473-
#summary .status-warning { background: #BC8034; }
474-
#summary .status-error { background: #B0413E; }
475+
#summary .status-success { background: {{ colors.success|raw }}; }
476+
#summary .status-warning { background: {{ colors.warning|raw }}; }
477+
#summary .status-error { background: {{ colors.error|raw }}; }
475478

476479
#summary .status-success h2,
477480
#summary .status-success h2 a,
@@ -670,10 +673,10 @@ tr.status-warning td {
670673
}
671674

672675
#menu-profiler .label-status-warning .count {
673-
background: #BC8034;
676+
background: {{ colors.warning|raw }};
674677
}
675678
#menu-profiler .label-status-error .count {
676-
background: #B0413E;
679+
background: {{ colors.error|raw }};
677680
}
678681

679682
{# Timeline panel

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
{# when updating any of these colors, do the same in profiler.css.twig #}
2+
{% set colors = { 'success': '#4F805D', 'warning': '#A46A1F', 'error': '#B0413E' } %}
3+
14
.sf-minitoolbar {
25
background-color: #222;
36
border-top-left-radius: 4px;
@@ -46,8 +49,8 @@
4649
}
4750
.sf-toolbarreset svg,
4851
.sf-toolbarreset img {
49-
max-height: 24px;
50-
max-width: 24px;
52+
max-height: 20px;
53+
max-width: 20px;
5154
}
5255

5356
.sf-toolbarreset .hide-button {
@@ -180,30 +183,31 @@
180183
padding: 3px 6px;
181184
margin-bottom: 2px;
182185
vertical-align: middle;
183-
min-width: 6px;
186+
min-width: 15px;
184187
min-height: 13px;
188+
text-align: center;
185189
}
186190

187191
.sf-toolbar-block .sf-toolbar-status-green {
188-
background-color: rgba(117, 158, 43, 0.8);
192+
background-color: {{ colors.success|raw }};
189193
}
190194
.sf-toolbar-block .sf-toolbar-status-red {
191-
background-color: rgba(200, 43, 43, 0.8);
195+
background-color: {{ colors.error|raw }};
192196
}
193197
.sf-toolbar-block .sf-toolbar-status-yellow {
194-
background-color: rgb(189, 132, 0);
198+
background-color: {{ colors.warning|raw }};
195199
}
196200

197201
.sf-toolbar-block.sf-toolbar-status-green {
198-
background-color: rgba(117, 158, 43, 0.8);
202+
background-color: {{ colors.success|raw }};
199203
color: #FFF;
200204
}
201205
.sf-toolbar-block.sf-toolbar-status-red {
202-
background-color: rgba(200, 43, 43, 0.8);
206+
background-color: {{ colors.error|raw }};
203207
color: #FFF;
204208
}
205209
.sf-toolbar-block.sf-toolbar-status-yellow {
206-
background-color: rgb(189, 132, 0);
210+
background-color: {{ colors.warning|raw }};
207211
color: #FFF;
208212
}
209213

0 commit comments

Comments
 (0)