cross-posted from: https://lemmy.world/post/31789585

CSS for Inverting Only Bright Images in Obsidian

Hello, I’m looking for CSS code that can invert only bright images in Obsidian. Could you provide me with a script or guidance on how to achieve this? I’m not familiar with CSS, but I’d appreciate any help or clarification on the process

Thanks in advance

cross-posted from: https://lemmy.world/post/31789585 Please see the cross-post as it is updated.

  • shnizmuffin@lemmy.inbutts.lol
    link
    fedilink
    English
    arrow-up
    2
    ·
    5 hours ago

    CSS by itself cannot determine the colors present in an image element, so you won’t be able to write a style targeting all your images.

    If you’re willing to attach a class to all your bright images, you could use the filter property.

    HTML

    <img class="invert" src="some-bright-image.jpg" />
    

    CSS

    
    .invert {
      filter: invert(1);
    }