8000 feature #31919 [WebProfilerBundle] Select default theme based on user… · symfony/symfony@cc1fc5b · GitHub
[go: up one dir, main page]

Skip to content

Commit cc1fc5b

Browse files
committed
feature #31919 [WebProfilerBundle] Select default theme based on user preferences (javiereguiluz)
This PR was merged into the 4.4 branch. Discussion ---------- [WebProfilerBundle] Select default theme based on user preferences | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | - | License | MIT | Doc PR | (not needed) This is the same we recently added to symfony.com website. It works on latest versions of Firefox and Safari only (Chrome will add support soon). Commits ------- 0fc0a34 [WebProfilerBundle] Select default theme based on user preferences
2 parents c33f69c + 0fc0a34 commit cc1fc5b

File tree

1 file changed

+5
-2
lines changed
  • src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler

1 file changed

+5
-2
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
{% endblock %}
1515
</head>
1616
<body>
17-
<script async>
18-
document.body.classList.add(localStorage.getItem('symfony/profiler/theme') || 'theme-light', localStorage.getItem('symfony/profiler/width') || 'width-normal');
17+
<script>
18+
document.body.classList.add(
19+
localStorage.getItem('symfony/profiler/theme') || (matchMedia('(prefers-color-scheme: dark)').matches ? 'theme-dark' : 'theme-light'),
20+
localStorage.getItem('symfony/profiler/width') || 'width-normal'
21+
);
1922
</script>
2023

2124
{% block body '' %}

0 commit comments

Comments
 (0)
0