Skip to content
Open
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
5 changes: 3 additions & 2 deletions admin/src/components/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import { useIntl } from "react-intl";
import TagsInput from "react-tagsinput";
import Autosuggest from "react-autosuggest";
import { getStyling } from "./styles/global";
import { getCurrentTheme } from '../utils/getCurrentTheme';

const ThemeStyle = getStyling(localStorage.getItem("STRAPI_THEME"));
const ThemeStyle = getStyling(getCurrentTheme());

const Tags = ({
attribute,
Expand Down Expand Up @@ -145,7 +146,7 @@ const Tags = ({
[attrName]: state[attrName] || "",
}));
}

return (
<Autosuggest
ref={props.ref}
Expand Down
6 changes: 6 additions & 0 deletions admin/src/utils/getCurrentTheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const getCurrentTheme = () => {
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark" : "light";
const strapiTheme = localStorage.getItem("STRAPI_THEME");

return (!strapiTheme || strapiTheme === 'system') ? systemTheme : strapiTheme;
};