Search code examples
javascripthtmleffectlight

Effect of lights off / lights on on HTML website


I was wondering if it is possible to simulate the lights off / lights on effect on a website. When a button is clicked the website would go dark (whatever darkness could be simulated as...) or just turn on the lights and the website would be visible again. I am really blank on the matter... I am not sure if this could be done by just changing the website element colours in a very specific way or with some type of effects library, canvas... I really have no idea.

Can someone clarify me? Sorry for mistakes, I am new to the matter


Solution

  • There is no magic solution that turns your theme to dark/bright.

    The best i can thing of is css html.inverse *, html.inverse { filter: invers(); } but even that don't work nicely.
    Another is just a dark div overlay with opacity and css click through. You are probably best of creating two different stylesheet (some css preprocessor has darker/brighter mixin and variables that you can use to help you build different stylesheet)

    if you still insist with some magical solution that works for every site/css then maybe https://www.turnoffthelights.com is something for you. they also have a bookmarklet that tries to do magic the best it can

    Otherwise this question is just to broad...