Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add system dark mode detection for Vue apps #11624 #11667

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions arches/app/templates/base-root.htm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
gtag('config', '{{app_settings.GOOGLE_ANALYTICS_TRACKING_ID}}');
</script>
{% endif %}
<script>
const darkModeToggleState = localStorage.getItem("arches-dark");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class name is hard coded, because I don't see a way to read it dynamically from the DEFAULT_THEME js file. If project developers have a different use case, as a last resort, this template could be overridden.

if (
darkModeToggleState === "true" ||
(darkModeToggleState === null &&
window.matchMedia("(prefers-color-scheme: dark)").matches)
) {
document.documentElement.classList.add("arches-dark");
}
</script>
<title>
{% block title %}{% endblock title %}
</title>
Expand Down
1 change: 1 addition & 0 deletions releases/8.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Arches 8.0.0 Release Notes
- Make node aliases not nullable [#10437](https://github.com/archesproject/arches/issues/10437)
- Concepts API no longer responds with empty body for error conditions [#11519](https://github.com/archesproject/arches/issues/11519)
- Removes sample index from new projects, updates test coverage behavior [#11591](https://github.com/archesproject/arches/issues/11519)
- Add system dark mode detection for Vue apps [#11624](https://github.com/archesproject/arches/issues/11624)
- Make number datatype node values searchable in the main search [#11619](https://github.com/archesproject/arches/issues/11619)
- Prevent navigation to a new browser tab when clicking Manage link in index.htm [#11635](https://github.com/archesproject/arches/issues/11635)

Expand Down
Loading