Skip to content

Commit

Permalink
IMP: text color #80, fix moon button position
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienMaille authored and actions-user committed Jul 17, 2024
1 parent ac7bf64 commit 609fd3e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions default-dynamic.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let current = "4.9";
let current = "5.0";

function waitForElement(els, func, timeout = 100) {
const queries = els.map((el) => document.querySelector(el));
Expand Down Expand Up @@ -142,11 +142,11 @@ window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e)
toggleDark(e.matches);
});

waitForElement([".main-topBar-container"], (queries) => {
waitForElement([".main-topBar-topbarContentRight"], (queries) => {
// Add activator on top bar
const div = document.createElement("div");
div.id = "main-topBar-moon-div";
queries[0].insertBefore(div, queries[0].querySelector(".main-userWidget-box"));
queries[0].insertBefore(div, queries[0].querySelector(".main-actionButtons"));

const button = document.createElement("button");
button.id = "main-topBar-moon-button";
Expand All @@ -163,7 +163,9 @@ function updateColors(textColHex) {
if (textColHex == undefined) return registerCoverListener();

let isLightBg = isLight(textColorBg);
if (isLightBg) textColHex = lightenDarkenColor(textColHex, -15); // vibrant color is always too bright for white bg mode
if (isLightBg)
textColHex = lightenDarkenColor(textColHex, -15); // vibrant color is always too bright for white bg mode
else textColHex = setLightness(textColHex, 0.45);

let darkColHex = lightenDarkenColor(textColHex, isLightBg ? 12 : -20);
let darkerColHex = lightenDarkenColor(textColHex, isLightBg ? 30 : -40);
Expand Down

0 comments on commit 609fd3e

Please sign in to comment.