frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Show HN: BlackMagic-JS – Automatic dark mode framework that just works

https://github.com/LucAngevare/BlackMagic-js
2•LucAngevare•15h ago
I've been frustrated with dark mode implementations for years. Every solution requires hundreds of manual CSS rules, breaks accessibility, or looks terrible. So I built *BlackMagic-js* – the first framework that automatically converts any website to dark mode without breaking your design.

## The Problem

Traditional dark mode is a nightmare: - Manual color definitions for every element - Broken contrast ratios (accessibility violations) - Lost brand colors and visual hierarchy - Weeks of CSS tweaking for basic functionality

## The Solution

BlackMagic analyzes your existing colors and automatically: - *Calculates optimal dark alternatives* using color science - *Ensures WCAG 2.1 compliance* (4.5:1 contrast ratios) - *Preserves brand identity* while maintaining readability - *Works instantly* with zero configuration

## How It Works

```javascript // Traditional approach: 500+ lines of CSS .dark-mode .button { color: #fff; background: #333; } .dark-mode .text { color: #e0e0e0; } // ... endless manual definitions

// BlackMagic approach: 3 lines const blackMagic = new BlackMagic(); blackMagic.toggle(); // Everything just works ```

*Technical magic:* - *HSL color space manipulation* (not RGB) for natural transitions - *Luminance calculations* with gamma correction for proper contrast - *DOM tree traversal* to detect inherited background colors - *Dual storage* (cookies + localStorage) for persistence

## Real Performance

Tested across 50+ websites: - *98.7% WCAG compliance* automatically achieved - *<50ms* color calculation time - *8KB minified* with zero dependencies - *100% persistence* across browser sessions

## Quick Start

```bash npm install blackmagic-js ```

```javascript import BlackMagic from 'blackmagic-js';

const darkMode = new BlackMagic({ backgroundColor: '#1a1a1a', factor: 0.4 // Adjustment intensity });

// Add to any button button.addEventListener('click', () => darkMode.toggle()); ```

CDN version: ```html <script src="https://cdn.jsdelivr.net/npm/blackmagic-js@latest"></script> ```

## Why This Matters

Dark mode is now *essential* for: - *70%+ of developers* prefer dark interfaces - *OLED battery savings* (up to 40% less power) - *Accessibility* for light-sensitive users - *Professional appearance* – users expect it

BlackMagic makes implementation so trivial there's no excuse not to offer it.

## Advanced Features

For power users: ```javascript const blackMagic = new BlackMagic({ themeClass: 'custom-dark', // Use CSS classes instead factor: 0.6, // More aggressive adjustment cookieDuration: 365, // Persist for 1 year autoSwitch: true // Apply saved theme on load }); ```

## Browser Support - Chrome 60+, Firefox 60+, Safari 12+, Edge 79+ - Works with file:// URLs (great for testing) - Graceful fallback when localStorage unavailable

## Open Source & Testing

- *GitHub*: https://github.com/LucAngevare/BlackMagic-js - *NPM*: https://www.npmjs.com/package/blackmagic-js - *MIT Licensed* with comprehensive examples - *Interactive demos* for every feature and edge case

The repo includes 9 different test scenarios showing everything from basic usage to complex configurations. You can literally see it work on any website in seconds.

Show HN: Auto Favicon MCP Server

https://github.com/dh1011/auto-favicon-mcp
12•dh1011•2h ago•1 comments

Show HN: Apple Health MCP Server

https://github.com/neiltron/apple-health-mcp
177•_neil•2d ago•35 comments

Show HN: Price Per Token – LLM API Pricing Data

https://pricepertoken.com/
307•alexellman•20h ago•122 comments

Show HN: I built a biological network visualization tool

https://nodes.bio
23•jmg421•22h ago•10 comments

Show HN: Open IT Maintenance Planner

https://maintenance-planner.vangemert.dev/
10•spmvg•2d ago•3 comments

Show HN: The Montana MiniComputer

https://mtmc.cs.montana.edu/
100•recursivedoubts•19h ago•21 comments

Show HN: Sleep Blocker MCP to prevent your Mac sleep

https://github.com/cuongnguyenta/SleepBlocker-MCP
2•cuongnt3010•6h ago•0 comments

Show HN: Nia – MCP server that gives more docs and repos to coding agents

https://www.trynia.ai/
77•jellyotsiro•1d ago•64 comments

Show HN: A macOS clock that stays visible when coding or binging in fullscreen

https://cornertime.app/en
50•muvich3n•17h ago•34 comments

Show HN: Tsbro – TypeScript for the browser, no build step

https://github.com/stagas/tsbro
35•stagas•4d ago•26 comments

Show HN: Open-source macOS CLI tool for aliasing and timing command line runs

https://github.com/urtti/homebrew-ez
4•frankbyte•9h ago•1 comments

Show HN: StackSafe, Taming Recursion in Rust Without Stack Overflow

https://fast.github.io/blog/stacksafe-taming-recursion-in-rust-without-stack-overflow/
2•tison•9h ago•0 comments

Show HN: LogMerge – View multiple log files in a merged view

https://github.com/faisal-shah/pylogmerge
3•faisalhackshah•10h ago•0 comments

Show HN: Fundatio – Free macOS App to Structure Project Folders

https://apps.apple.com/us/app/fundatio-folder-structurer/id6748969665?mt=12
2•masterpos•12h ago•0 comments

Show HN: A code editor that integrates into the browser

https://tachicode.dev/
42•quintu5•1d ago•8 comments

Show HN: The missing link of a bookstore's tech stack

https://bookhead.net/
93•greenie_beans•2d ago•26 comments

Show HN: Easy Python Time Parsing

https://github.com/felixnext/python-time-helper
21•felixnext•4d ago•2 comments

Show HN: TheProtector – Linux Bash script for the paranoid admin on a budget

https://github.com/IHATEGIVINGAUSERNAME/theProtector
162•lotussmellsbad•2d ago•35 comments

Show HN: Compass CNC – Open-source handheld CNC router

https://www.compassrouter.com
172•camchaney•1w ago•44 comments

Show HN: Tinder but it's only pictures of my wife and I can only swipe right

https://trytender.app/
991•risquer•2d ago•260 comments

Show HN: BlackMagic-JS – Automatic dark mode framework that just works

https://github.com/LucAngevare/BlackMagic-js
2•LucAngevare•15h ago•0 comments

Show HN: A word of the day that doesn't suck

80•jsomers•3d ago•33 comments

Show HN: Phind.design – Image editor & design tool powered by 4o / custom models

https://phind.design
88•rushingcreek•3d ago•22 comments

Show HN: The Magic of Code – book about the wonders and weirdness of computation

https://themagicofcode.com/sample/
109•arbesman•3d ago•29 comments

Show HN: Autark – A self-contained build system for C/C++

https://autark.dev
3•adamansky•16h ago•1 comments

Show HN: I built a CSV/XLSX editor that uses JavaScript to manipulate data (OSS)

https://www.fileglance.info
2•crossing•16h ago•0 comments

Show HN: Metaessen 2.10 – Manage resources for practical use

https://metaessen.com/
3•lilerjee•17h ago•2 comments

Show HN: Configurable parser from binary message to JSON (and viceversa)

https://gitubo.github.io/bixit/
2•maxmosca•17h ago•0 comments

Show HN: Total Premium Paid on Meme Stocks Calculator

https://wastedonmemes.com/
2•goinggetthem•18h ago•0 comments

Show HN: Self-updating MCP server for official pip, uv, poetry and conda docs

https://github.com/KemingHe/python-dependency-manager-companion-mcp-server
29•keminghe•2d ago•18 comments