
Show HN: Tiny (222 Bytes) Dark Mode bookmarklet to enable darkmode anywhere - x8d
https://github.com/x08d/222
======
gabrielsroka
This is really neat! It would be great as a Greasemonkey script or a browser
extension.

Nitpick, it's actually 221 bytes. And if you

    
    
      e.getAttribute('style')
    

on something that doesn't have style, it returns `null`. So maybe

    
    
      (e.getAttribute('style') || '')

~~~
x8d
Hey thanks, I had this condition in the script at one point, but then I
started minifying it and although this makes the style attribute look a bit
ugly the functionality stays the same, so it had to go.

------
kseistrup
Thanks, that's really neat.

Would it be possible to make it a switch so that clicking the bookmarklet
toggles darkmode?

~~~
kseistrup
Oh, it has already been added as an issue:
[https://github.com/x08d/222/issues/2](https://github.com/x08d/222/issues/2)

------
datfrojo
What are you going to do if you ever need to make any sort of change to the
project? Rename the project?

~~~
quickthrower2
222 is also the hex color, so the name would make sense still.

------
beckyb
This is awesome, thank you!

