News for hackers. Stuff that matters.
Re:Show HN: Tiny (222 Bytes) Dark Mode bookmarklet to enable... by gabrielsroka on Saturday June 06, 2020 @07:09PM (#23443157)
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') || '')
Re:Show HN: Tiny (222 Bytes) Dark Mode bookmarklet to enable... by x8d on Sunday June 07, 2020 @03:29AM (#23445485)
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.
Re:Show HN: Tiny (222 Bytes) Dark Mode bookmarklet to enable... by kseistrup on Sunday June 07, 2020 @03:34AM (#23445506)
Thanks, that's really neat.

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

Re:Show HN: Tiny (222 Bytes) Dark Mode bookmarklet to enable... by kseistrup on Sunday June 07, 2020 @03:35AM (#23445511)
Oh, it has already been added as an issue: https://github.com/x08d/222/issues/2
Re:Show HN: Tiny (222 Bytes) Dark Mode bookmarklet to enable... by datfrojo on Saturday June 06, 2020 @06:43PM (#23442972)
What are you going to do if you ever need to make any sort of change to the project? Rename the project?
Re:Show HN: Tiny (222 Bytes) Dark Mode bookmarklet to enable... by quickthrower2 on Saturday June 06, 2020 @07:04PM (#23443129)
222 is also the hex color, so the name would make sense still.
Re:Show HN: Tiny (222 Bytes) Dark Mode bookmarklet to enable... by beckyb on Saturday June 06, 2020 @08:48PM (#23443701)
This is awesome, thank you!