Skip to content

Commit

Permalink
fix(ecosia): get dialog theme from background
Browse files Browse the repository at this point in the history
  • Loading branch information
iorate committed Jun 16, 2024
1 parent 356611b commit 8b60121
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/scripts/search-engines/ecosia.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SEARCH_ENGINES } from "../../common/search-engines.ts";
import type { SearchEngine, SerpHandler } from "../types.ts";
import { handleSerp } from "./helpers.ts";
import { handleSerp, hasDarkBackground } from "./helpers.ts";

function getSerpHandler(): SerpHandler {
return handleSerp({
Expand Down Expand Up @@ -46,6 +46,10 @@ function getSerpHandler(): SerpHandler {
$site: "ecosia",
$category: "web",
},
getDialogTheme: () => {
const layout = document.querySelector<HTMLElement>(".layout");
return layout && hasDarkBackground(layout) ? "dark" : "light";
},
});
}

Expand Down

0 comments on commit 8b60121

Please sign in to comment.