Skip to content

Commit 079b789

Browse files
committed
🔧fix: duckduckgo dark theme visibility
extension text inherit text color from body style in all search engines, and upon changing theme, body text color got updated, but that's not the case for duckduckgo. So I update the body style manually
1 parent 72d35be commit 079b789

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/pages/content/index.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getLogseqCopliotConfig } from '@/config';
2+
import { fixDuckDuckGoDark } from '@/utils';
23
import { createRoot } from 'react-dom/client';
34
import Browser from 'webextension-polyfill';
45
import { LogseqCopliot } from './LogseqCopliot';
@@ -27,6 +28,10 @@ async function run(
2728
) {
2829
console.debug('Logseq copliot', window.location.hostname);
2930

31+
if (searchEngine instanceof DuckDuckGo) {
32+
fixDuckDuckGoDark()
33+
}
34+
3035
const query = searchEngine.getQuery();
3136
if (query) {
3237
console.log(`match ${typeof searchEngine}, query ${query}`);

src/utils.ts

+6
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,9 @@ export const buildTurndownService = () => {
8383

8484
return turndownService;
8585
};
86+
87+
export const fixDuckDuckGoDark = () => {
88+
if (document.querySelector('.dark-bg')) {
89+
document.body.style.color = 'var(--theme-col-txt-snippet)';
90+
}
91+
}

0 commit comments

Comments
 (0)