Skip to content

Commit

Permalink
bug #30860 [Profiler] Fix dark theme elements color (dFayet)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 4.2 branch (closes #30860).

Discussion
----------

[Profiler] Fix dark theme elements color

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #29194   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | -

I think the color handling of the code highlighted (exceptions, ...) is quite questionnable, but as we use the `highlight_file()` function, I don't really see an other way to handle it, tell me what you think.

###  Before/After
**Form**
![Capture d’écran de 2019-04-04 10-07-18](https://user-images.githubusercontent.com/7721219/55539945-2cfe0580-56c2-11e9-8e5c-a4b6352ab12d.png)

![Capture d’écran de 2019-04-04 10-03-27](https://user-images.githubusercontent.com/7721219/55539906-15268180-56c2-11e9-90e7-326cc1c01ccd.png)

**Twig render graph**
![Capture d’écran de 2019-04-04 10-07-36](https://user-images.githubusercontent.com/7721219/55539969-3b4c2180-56c2-11e9-9064-1fd10bf1da02.png)

![Capture d’écran de 2019-04-06 19-37-02](https://user-images.githubusercontent.com/7721219/55673094-693c8c00-58a3-11e9-90a4-76f6b312d516.png)

**Exceptions**
![Capture d’écran de 2019-04-04 10-08-19](https://user-images.githubusercontent.com/7721219/55540012-51f27880-56c2-11e9-930b-98d680093e49.png)

![Capture d’écran de 2019-04-06 09-39-27](https://user-images.githubusercontent.com/7721219/55667421-4f2b8b00-585c-11e9-81c7-dc09bd982375.png)

**Doctrine queries**
![Capture d’écran de 2019-04-04 10-08-37](https://user-images.githubusercontent.com/7721219/55540059-73536480-56c2-11e9-9b0d-ea691a16a1a5.png)

![Capture d’écran de 2019-04-04 10-04-47](https://user-images.githubusercontent.com/7721219/55540068-78b0af00-56c2-11e9-88f7-2181800006a7.png)

Commits
-------

8a9c2c8 [Profiler] Fix dark theme elements color
  • Loading branch information
fabpot committed Apr 6, 2019
2 parents 4c3a48a + 8a9c2c8 commit 07a1095
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 49 deletions.
2 changes: 2 additions & 0 deletions src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php
Expand Up @@ -127,10 +127,12 @@ public function getHtmlCallGraph()
'<span style="background-color: #ffd">',
'<span style="color: #d44">',
'<span style="background-color: #dfd">',
'<span style="background-color: #ddf">',
], [
'<span class="status-warning">',
'<span class="status-error">',
'<span class="status-success">',
'<span class="status-info">',
], $dump);

return new Markup($dump, 'UTF-8');
Expand Down
Expand Up @@ -25,10 +25,10 @@
{% if trace.file|default(false) %}
<div id="trace-html-{{ prefix ~ '-' ~ i }}" class="trace-code sf-toggle-content">
{{ trace.file|file_excerpt(trace.line, 5)|replace({
'#DD0000': '#183691',
'#007700': '#a71d5d',
'#0000BB': '#222222',
'#FF8000': '#969896'
'#DD0000': 'var(--highlight-string)',
'#007700': 'var(--highlight-keyword)',
'#0000BB': 'var(--highlight-default)',
'#FF8000': 'var(--highlight-comment)'
})|raw }}
</div>
{% endif %}
49 changes: 28 additions & 21 deletions src/Symfony/Bundle/TwigBundle/Resources/views/exception.css.twig
Expand Up @@ -23,8 +23,15 @@
--table-border: #e0e0e0;
--table-background: #fff;
--table-header: #e0e0e0;
--tree-active-background: #F7E5A1;
--exception-title-color: var(--base-2);
--shadow: 0px 0px 1px rgba(128, 128, 128, .2);
--border: 1px solid #e0e0e0;
--background-error: var(--color-error);
--highlight-comment: #969896;
--highlight-default: #222222;
--highlight-keyword: #a71d5d;
--highlight-string: #183691;
--base-0: #fff;
--base-1: #f5f5f5;
--base-2: #e0e0e0;
Expand All @@ -40,7 +47,7 @@ html {
/* always display the vertical scrollbar to avoid jumps when toggling contents */
overflow-y: scroll;
}
body { background-color: #F9F9F9; color: #222; font: 14px/1.4 Helvetica, Arial, sans-serif; padding-bottom: 45px; }
body { background-color: #F9F9F9; color: var(--base-6); font: 14px/1.4 Helvetica, Arial, sans-serif; padding-bottom: 45px; }

a { cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
Expand All @@ -49,9 +56,9 @@ abbr[title] { border-bottom: none; cursor: help; text-decoration: none; }
code, pre { font: 13px/1.5 Consolas, Monaco, Menlo, "Ubuntu Mono", "Liberation Mono", monospace; }

table, tr, th, td { background: #FFF; border-collapse: collapse; vertical-align: top; }
table { background: #FFF; border: 1px solid #E0E0E0; box-shadow: 0px 0px 1px rgba(128, 128, 128, .2); margin: 1em 0; width: 100%; }
table th, table td { border: solid #E0E0E0; border-width: 1px 0; padding: 8px 10px; }
table th { background-color: #E0E0E0; font-weight: bold; text-align: left; }
table { background: #FFF; border: var(--border); box-shadow: 0px 0px 1px rgba(128, 128, 128, .2); margin: 1em 0; width: 100%; }
table th, table td { border: solid var(--base-2); border-width: 1px 0; padding: 8px 10px; }
table th { background-color: var(--base-2); font-weight: bold; text-align: left; }

.m-t-5 { margin-top: 5px; }
.hidden-xs-down { display: none; }
Expand All @@ -65,15 +72,15 @@ table th { background-color: #E0E0E0; font-weight: bold; text-align: left; }
.text-small { font-size: 12px !important; }
.text-muted { color: #999; }
.text-bold { font-weight: bold; }
.empty { border: 4px dashed #E0E0E0; color: #999; margin: 1em 0; padding: .5em 2em; }
.empty { border: 4px dashed var(--base-2); color: #999; margin: 1em 0; padding: .5em 2em; }

.status-success { background: rgba(94, 151, 110, 0.3); }
.status-warning { background: rgba(240, 181, 24, 0.3); }
.status-error { background: rgba(176, 65, 62, 0.2); }
.status-success td, .status-warning td, .status-error td { background: transparent; }
tr.status-error td, tr.status-warning td { border-bottom: 1px solid #FAFAFA; border-top: 1px solid #FAFAFA; }
.status-warning .colored { color: #A46A1F; }
.status-error .colored { color: #B0413E; }
.status-error .colored { color: var(--color-error); }

.sf-toggle { cursor: pointer; }
.sf-toggle-content { -moz-transition: display .25s ease; -webkit-transition: display .25s ease; transition: display .25s ease; }
Expand All @@ -91,7 +98,7 @@ thead.sf-toggle-content.sf-toggle-visible, tbody.sf-toggle-content.sf-toggle-vis
.tab-navigation li.active .badge { background-color: var(--base-5); color: var(--base-2); }
.tab-content > *:first-child { margin-top: 0; }
.tab-navigation li .badge.status-warning { background: var(--color-warning); color: #FFF; }
.tab-navigation li .badge.status-error { background: var(--color-error); color: #FFF; }
.tab-navigation li .badge.status-error { background: var(--background-error); color: #FFF; }
.sf-tabs .tab:not(:first-child) { display: none; }

[data-filters] { position: relative; }
Expand Down Expand Up @@ -131,7 +138,7 @@ thead.sf-toggle-content.sf-toggle-visible, tbody.sf-toggle-content.sf-toggle-vis
.container { max-width: 1024px; margin: 0 auto; padding: 0 15px; }
.container::after { content: ""; display: table; clear: both; }

header { background-color: #222; color: rgba(255, 255, 255, 0.75); font-size: 13px; height: 33px; line-height: 33px; padding: 0; }
header { background-color: var(--base-6); color: rgba(255, 255, 255, 0.75); font-size: 13px; height: 33px; line-height: 33px; padding: 0; }
header .container { display: flex; justify-content: space-between; }
.logo { flex: 1; font-size: 13px; font-weight: normal; margin: 0; padding: 0; }
.logo svg { height: 18px; width: 18px; opacity: .8; vertical-align: -5px; }
Expand All @@ -142,7 +149,7 @@ header .container { display: flex; justify-content: space-between; }
.help-link a:hover { color: #EEE; text-decoration: none; }
.help-link a:hover svg { opacity: .9; }

.exception-summary { background: #B0413E; border-bottom: 2px solid rgba(0, 0, 0, 0.1); border-top: 1px solid rgba(0, 0, 0, .3); flex: 0 0 auto; margin-bottom: 15px; }
.exception-summary { background: var(--background-error); border-bottom: 2px solid rgba(0, 0, 0, 0.1); border-top: 1px solid rgba(0, 0, 0, .3); flex: 0 0 auto; margin-bottom: 15px; }
.exception-metadata { background: rgba(0, 0, 0, 0.1); padding: 7px 0; }
.exception-metadata .container { display: flex; flex-direction: row; justify-content: space-between; }
.exception-metadata h2, .exception-metadata h2 > a { color: rgba(255, 255, 255, 0.8); font-size: 13px; font-weight: 400; margin: 0; }
Expand All @@ -162,36 +169,36 @@ header .container { display: flex; justify-content: space-between; }
.exception-illustration { flex-basis: 111px; flex-shrink: 0; height: 66px; margin-left: 15px; opacity: .7; }

.trace + .trace { margin-top: 30px; }
.trace-head { background-color: #e0e0e0; padding: 10px; position: relative; }
.trace-head .trace-class { color: #222; font-size: 18px; font-weight: bold; line-height: 1.3; margin: 0; position: relative; }
.trace-head { background-color: var(--base-2); padding: 10px; position: relative; }
.trace-head .trace-class { color: var(--base-6); font-size: 18px; font-weight: bold; line-height: 1.3; margin: 0; position: relative; }
.trace-head .trace-namespace { color: #999; display: block; font-size: 13px; }
.trace-head .icon { position: absolute; right: 0; top: 0; }
.trace-head .icon svg { height: 24px; width: 24px; }

.trace-details { background: #FFF; border: 1px solid #E0E0E0; box-shadow: 0px 0px 1px rgba(128, 128, 128, .2); margin: 1em 0; table-layout: fixed; }
.trace-details { background: var(--base-0); border: var(--border); box-shadow: 0px 0px 1px rgba(128, 128, 128, .2); margin: 1em 0; table-layout: fixed; }

.trace-message { font-size: 14px; font-weight: normal; margin: .5em 0 0; }

.trace-line { position: relative; padding-top: 8px; padding-bottom: 8px; }
.trace-line + .trace-line { border-top: 1px solid #e0e0e0; }
.trace-line:hover { background: #F5F5F5; }
.trace-line a { color: #222; }
.trace-line + .trace-line { border-top: var(--border); }
.trace-line:hover { background: var(--base-1); }
.trace-line a { color: var(--base-6); }
.trace-line .icon { opacity: .4; position: absolute; left: 10px; top: 11px; }
.trace-line .icon svg { height: 16px; width: 16px; }
.trace-line-header { padding-left: 36px; padding-right: 10px; }

.trace-file-path, .trace-file-path a { color: #222; font-size: 13px; }
.trace-class { color: #B0413E; }
.trace-file-path, .trace-file-path a { color: var(--base-6); font-size: 13px; }
.trace-class { color: var(--color-error); }
.trace-type { padding: 0 2px; }
.trace-method { color: #B0413E; font-weight: bold; }
.trace-method { color: var(--color-error); font-weight: bold; }
.trace-arguments { color: #777; font-weight: normal; padding-left: 2px; }

.trace-code { background: #FFF; font-size: 12px; margin: 10px 10px 2px 10px; padding: 10px; overflow-x: auto; white-space: nowrap; }
.trace-code { background: var(--base-0); font-size: 12px; margin: 10px 10px 2px 10px; padding: 10px; overflow-x: auto; white-space: nowrap; }
.trace-code ol { margin: 0; float: left; }
.trace-code li { color: #969896; margin: 0; padding-left: 10px; float: left; width: 100%; }
.trace-code li + li { margin-top: 5px; }
.trace-code li.selected { background: #F7E5A1; margin-top: 2px; }
.trace-code li code { color: #222; white-space: nowrap; }
.trace-code li.selected { background: var(--trace-selected-background); margin-top: 2px; }
.trace-code li code { color: var(--base-6); white-space: nowrap; }

.trace-as-text .stacktrace { line-height: 1.8; margin: 0 0 15px; white-space: pre-wrap; }

Expand Down
Expand Up @@ -10,8 +10,8 @@
}

.exception-summary {
background: #FFF;
border: 1px solid #E0E0E0;
background: var(--base-0);
border: var(--border);
box-shadow: 0 0 1px rgba(128, 128, 128, .2);
margin: 1em 0;
padding: 10px;
Expand All @@ -21,7 +21,7 @@
}

.exception-message {
color: #B0413E;
color: var(--color-error);
}

.exception-metadata,
Expand Down
Expand Up @@ -131,8 +131,11 @@
.tree .tree-inner:hover {
background: #dfdfdf;
}
.tree .tree-inner:hover span:not(.has-error) {
color: var(--base-0);
}
.tree .tree-inner.active, .tree .tree-inner.active:hover {
background: #E0E0E0;
background: var(--tree-active-background);
font-weight: bold;
}
.tree .tree-inner.active .toggle-icon, .tree .tree-inner:hover .toggle-icon, .tree .tree-inner.active:hover .toggle-icon {
Expand All @@ -153,25 +156,25 @@
}
.badge-error {
float: right;
background: #B0413E;
background: var(--background-error);
color: #FFF;
padding: 1px 4px;
font-size: 10px;
font-weight: bold;
vertical-align: middle;
}
.has-error {
color: #B0413E;
color: var(--color-error);
}
.errors h3 {
color: #B0413E;
color: var(--color-error);
}
.errors th {
background: #B0413E;
background: var(--background-error);
color: #FFF;
}
.errors .toggle-icon {
background-color: #B0413E;
background-color: var(--background-error);
}
h3 a, h3 a:hover, h3 a:focus {
color: inherit;
Expand All @@ -183,6 +186,20 @@
h3.form-data-type + h3 {
margin-top: 1em;
}
.theme-dark .toggle-icon {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAgBAMAAADpp+X/AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAVUExURUdwTH+Ag0lNUZiYmGRmbP///zU5P2n9VV4AAAAFdFJOUwCv+yror0g1sQAAAE1JREFUGNNjSFM0YGBgEEpjSGEAAzcGBQiDiUEAwmBkMIAwmBmwgVAgQGWgA7h2uIFwK+CWwp1BpHtYA6DuATEYkBlY3IOmBq6dCPcAAKMtEEs3tfChAAAAAElFTkSuQmCC');
}
.theme-dark .toggle-icon.empty {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAASUExURUdwTDI3OzQ5PS4uLjU3PzU5P4keoyIAAAAFdFJOUwBApgtzrnKGEwAAADJJREFUCNdjCFU0YGBgEAplCGEAA1cGBQiDiUEAwmBkMIAwmBnIA3DtcAPhVsAthTkDACsZBBmrTTSxAAAAAElFTkSuQmCC');
}
.theme-dark .tree .tree-inner.active .toggle-icon, .theme-dark .tree .tree-inner:hover .toggle-icon, .theme-dark .tree .tree-inner.active:hover .toggle-icon {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAgBAMAAADpp+X/AAAAD1BMVEVHcEx/gIOYmJiZmZn///+IJ2wIAAAAA3RSTlMAryoIUq0uAAAAUElEQVQY02NgYFQ2NjYWYGBgMAYDBgZmCMOAQRjCMGRQhjCMoEqAipAYLkCAykBXA9cONxBuBdxShDOIc4+JM9Q9IIYxMgOLe9DUwLUT4R4AznguG0qfEa0AAAAASUVORK5CYII=');
background-color: transparent;
}
.theme-dark .tree .tree-inner.active .toggle-icon.empty, .theme-dark .tree .tree-inner:hover .toggle-icon.empty, .theme-dark .tree .tree-inner.active:hover .toggle-icon.empty {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAACVBMVEVHcEwyNzuqqqrd9nIgAAAAAnRSTlMAQABPjKgAAAArSURBVAjXY2BctcqBgWvVqgUMWqtWrWDIWrVqJcMqICCGACsGawMbADIKANflJYEoGMqtAAAAAElFTkSuQmCC');
background-color: transparent;
}
</style>
{% endblock %}

Expand Down
Expand Up @@ -144,7 +144,12 @@

<div class="hidden" id="sf-trace-{{ discr }}-{{ loop.index0 }}">
<div class="trace">
{{ caller.file|file_excerpt(caller.line) }}
{{ caller.file|file_excerpt(caller.line)|replace({
'#DD0000': 'var(--highlight-string)',
'#007700': 'var(--highlight-keyword)',
'#0000BB': 'var(--highlight-default)',
'#FF8000': 'var(--highlight-comment)'
})|raw }}
</div>
</div>
</td>
Expand Down
Expand Up @@ -59,7 +59,12 @@

<div class="sf-validator-compact hidden" id="sf-trace-{{ loop.index0 }}">
<div class="trace">
{{ caller.file|file_excerpt(caller.line) }}
{{ caller.file|file_excerpt(caller.line)|replace({
'#DD0000': 'var(--highlight-string)',
'#007700': 'var(--highlight-keyword)',
'#0000BB': 'var(--highlight-default)',
'#FF8000': 'var(--highlight-comment)'
})|raw }}
</div>
</div>

Expand Down

0 comments on commit 07a1095

Please sign in to comment.