Skip to content

Commit

Permalink
fix: 🐛 Google dark mode check
Browse files Browse the repository at this point in the history
  • Loading branch information
haozi committed Feb 13, 2024
1 parent b8433be commit 01c3756
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions dist/chromium/content_script.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/content_script/chat-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ export default async (_config: Config) => {
if (isGoogle) {
prompt = new URLSearchParams(location.search).get('q') ?? ''
dir = document.documentElement.dir
darkmode = (document.querySelector('meta[name="color-scheme"]') as HTMLMetaElement)?.content === 'dark' ? 'dark' : ''
darkmode =
(document.querySelector('meta[name="color-scheme"]') as HTMLMetaElement)?.content === 'dark' ||
getComputedStyle(document.body || document.documentElement).backgroundColor === 'rgb(32, 33, 36)' ||
document.querySelector('meta[name="color-scheme"]')
? 'dark'
: ''
}
// if (isBing) {
// prompt = new URLSearchParams(location.search).get('q') ?? ''
Expand Down

0 comments on commit 01c3756

Please sign in to comment.