From 47688337dd82c9af1db0c7c2a6cde0ca5c361ac5 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 4 Dec 2024 12:02:52 +0100 Subject: [PATCH] also dim svg images --- static/js/markdown.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/static/js/markdown.js b/static/js/markdown.js index 9d9b189..0d8b97d 100644 --- a/static/js/markdown.js +++ b/static/js/markdown.js @@ -54,13 +54,21 @@ const svgChangeTheme = (mode) => { const treshold = 128; + const style = "filter: "; + const dim = "brightness(0.8) contrast(1.2)"; + if (averageGrayscale < treshold && mode === Mode.Dark) { - item.style = "filter: invert(1);"; + item.style = style + dim + " invert(1);"; continue; } if (averageGrayscale > treshold && mode === Mode.Light) { - item.style = "filter: invert(1);"; + item.style = style + "invert(1);"; + continue; + } + + if (mode === Mode.Dark) { + item.style = style + `${dim};`; continue; }