Skip to content

Commit

Permalink
fix: dark mode error (#2158)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinbao1001 authored Jul 2, 2024
1 parent 6128cb8 commit b109266
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/features/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,13 @@ export default (api: IApi) => {
}
}
}
if (memo.theme) {
memo.theme['dark-selector'] = `~'[${PREFERS_COLOR_ATTR}="dark"]'`;
} else if (memo.lessLoader) {
memo.lessLoader.lessOptions.modifyVars ??= {};
memo.lessLoader.lessOptions.modifyVars[
memo.theme ??= {};
memo.theme['dark-selector'] = `~'[${PREFERS_COLOR_ATTR}="dark"]'`;
if (memo.lessLoader) {
memo.lessLoader.modifyVars ??= {};
memo.lessLoader.modifyVars[
'dark-selector'
] = `~'[${PREFERS_COLOR_ATTR}="dark"]'`;
} else {
memo.theme = {
'dark-selector': `~'[${PREFERS_COLOR_ATTR}="dark"]'`,
};
}
return memo;
});
Expand Down

0 comments on commit b109266

Please sign in to comment.