What I’m trying to do
Make this css snippet work in edit mode and preview mode.
Things I have tried
Idk how to do it, it shows in preview mode but in edit mode it is just black backgorund instead of transparent
This is the snippet:
.theme-dark img {
filter: invert(1) hue-rotate(180deg);
mix-blend-mode: screen; }
The above snippet looks alright for me in Live Preview and Reading view.
![CleanShot 2024-04-07 at 10.20.43](https://forum.obsidian.md/uploads/default/original/3X/b/0/b0c9fa3066c825a4b3a2f24e31ee81e585001f2f.gif)
You could try different images or remove the mix-blend-mode
section.
mix-blend-mode: screen;
worked for me, but mix-blend-mode: darken;
created nearly black images in Reading view. Possibly something with that.
This is in edit mode:
![image](https://forum.obsidian.md/uploads/default/original/3X/c/b/cbfffb9b06f22424be86a3c0c957e842f2f6bf24.png)
And this is in preview mode:
![image](https://forum.obsidian.md/uploads/default/original/3X/c/3/c3185516b5f32ae8f33e6b15a03338f71ae8068c.png)
I don’[t want the black background in edit mode
Ahh, I see now. mix-blend-mode
doesn’t appear to do anything in the editor. I didn’t notice it with my original images.
![CleanShot 2024-04-07 at 12.06.21](https://forum.obsidian.md/uploads/default/original/3X/e/9/e9db57837c5a03ad7284c73a92ee9f302c46e879.gif)
If I find out why or a workaround, I’ll report back.
I’m not entirely sure why, but the issue seems like it’s the div
that the image is in. give this a try:
.cm-content > :has(> img) {
background-color: var(--background-primary);
}
.theme-dark img {
filter: invert(1) hue-rotate(180deg);
mix-blend-mode: screen;
}
system
Closed
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.