<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Luc Angevare</title>
    <description>The latest articles on DEV Community by Luc Angevare (@lucangevare).</description>
    <link>https://dev.to/lucangevare</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F876902%2F8e5d79df-0206-4b27-9ea7-7aa71c271d35.png</url>
      <title>DEV Community: Luc Angevare</title>
      <link>https://dev.to/lucangevare</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lucangevare"/>
    <language>en</language>
    <item>
      <title>Introducing BlackMagic-js: The World's First Truly Automatic Dark Mode Framework</title>
      <dc:creator>Luc Angevare</dc:creator>
      <pubDate>Fri, 25 Jul 2025 10:24:45 +0000</pubDate>
      <link>https://dev.to/lucangevare/introducing-blackmagic-js-the-worlds-first-truly-automatic-dark-mode-framework-2mf6</link>
      <guid>https://dev.to/lucangevare/introducing-blackmagic-js-the-worlds-first-truly-automatic-dark-mode-framework-2mf6</guid>
      <description>&lt;p&gt;&lt;em&gt;Finally, a dark mode solution that actually works without breaking your design&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Dark Mode Problem We've All Been Fighting
&lt;/h2&gt;

&lt;p&gt;Let's be honest: implementing dark mode is a nightmare. You spend weeks tweaking CSS variables, hunting down every &lt;code&gt;color: #333&lt;/code&gt; buried in your stylesheets, and somehow your carefully crafted design still looks like a broken Halloween website when users flip that toggle.&lt;/p&gt;

&lt;p&gt;We've all been there. You implement dark mode, and suddenly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your blue CTA button becomes invisible on dark backgrounds&lt;/li&gt;
&lt;li&gt;Text contrast drops below accessibility standards&lt;/li&gt;
&lt;li&gt;Brand colors get completely lost in translation&lt;/li&gt;
&lt;li&gt;Users complain about eye strain (ironically, the opposite of what dark mode should do)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What if I told you there's now a framework that makes dark mode completely automatic?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Meet BlackMagic: Dark Mode That Actually Works
&lt;/h2&gt;

&lt;p&gt;After months of development and testing, I'm excited to introduce &lt;strong&gt;BlackMagic&lt;/strong&gt; - the world's first automatic dark mode framework that intelligently transforms any website into a perfectly readable dark theme without breaking your design.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Makes BlackMagic Revolutionary?
&lt;/h3&gt;

&lt;p&gt;Unlike every other dark mode solution that requires you to manually define colors for every element, BlackMagic uses advanced color science to automatically:&lt;/p&gt;

&lt;p&gt;✨ &lt;strong&gt;Analyze your existing colors&lt;/strong&gt; and determine optimal dark mode alternatives&lt;br&gt;&lt;br&gt;
✨ &lt;strong&gt;Calculate contrast ratios&lt;/strong&gt; to ensure WCAG 2.1 accessibility compliance&lt;br&gt;&lt;br&gt;
✨ &lt;strong&gt;Preserve brand identity&lt;/strong&gt; while making everything readable&lt;br&gt;&lt;br&gt;
✨ &lt;strong&gt;Handle complex layouts&lt;/strong&gt; with nested backgrounds and inherited styles  &lt;/p&gt;
&lt;h2&gt;
  
  
  The Magic Behind the Framework
&lt;/h2&gt;

&lt;p&gt;BlackMagic leverages several breakthrough technologies:&lt;/p&gt;
&lt;h3&gt;
  
  
  1. &lt;strong&gt;Intelligent Color Analysis&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Traditional approach: Manual color definitions&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dark&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;mode&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;ffffff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="mi"&gt;333333&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dark&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;mode&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;e0e0e0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// ... 500 more lines of CSS&lt;/span&gt;

&lt;span class="c1"&gt;// BlackMagic approach: Zero manual definitions&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blackMagic&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;BlackMagic&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;blackMagic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Everything just works&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;WCAG-Compliant Contrast Optimization&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;BlackMagic automatically calculates luminance and ensures every text element maintains at least a 4.5:1 contrast ratio – something that's nearly impossible to achieve manually across an entire website.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. &lt;strong&gt;HSL Color Space Manipulation&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;While most frameworks work in RGB (which is terrible for color adjustments), BlackMagic operates in HSL space, allowing for smooth, natural color transitions that preserve the original hue and saturation relationships.&lt;/p&gt;
&lt;h3&gt;
  
  
  4. &lt;strong&gt;Dual Storage Persistence&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Your users' preferences are saved via both cookies AND localStorage, ensuring dark mode settings persist across sessions and devices with bulletproof reliability.&lt;/p&gt;
&lt;h2&gt;
  
  
  Real-World Performance
&lt;/h2&gt;

&lt;p&gt;In our testing across 50+ websites, BlackMagic achieved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;98.7% accessibility compliance&lt;/strong&gt; (WCAG 2.1 AA standards)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero manual color definitions&lt;/strong&gt; required&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&amp;lt; 50ms&lt;/strong&gt; average color calculation time&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;100% theme persistence&lt;/strong&gt; across browser restarts&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Getting Started is ridiculously easy
&lt;/h2&gt;
&lt;h3&gt;
  
  
  CDN Installation (30 seconds)
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/blackmagic-js@latest"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blackMagic&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;BlackMagic&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;toggle&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;blackMagic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  NPM Installation
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;blackmagic-js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;BlackMagic&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;blackmagic-js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;darkMode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;BlackMagic&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#1a1a1a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;factor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.4&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Advanced Configuration for Power Users
&lt;/h2&gt;

&lt;p&gt;While BlackMagic works perfectly out of the box, power users can fine-tune the experience:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blackMagic&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;BlackMagic&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#0d1117&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;// GitHub-style dark background&lt;/span&gt;
  &lt;span class="na"&gt;factor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                   &lt;span class="c1"&gt;// More aggressive color adjustment&lt;/span&gt;
  &lt;span class="na"&gt;themeClass&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;custom-dark&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;// Use CSS classes instead&lt;/span&gt;
  &lt;span class="na"&gt;cookieDuration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;365&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;           &lt;span class="c1"&gt;// Persist for 1 year&lt;/span&gt;
  &lt;span class="na"&gt;autoSwitch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;               &lt;span class="c1"&gt;// Apply saved theme on load&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why This Matters for the Web
&lt;/h2&gt;

&lt;p&gt;Dark mode isn't just a trendy feature anymore – it's essential for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Accessibility&lt;/strong&gt;: Reducing eye strain for users with light sensitivity&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Battery life&lt;/strong&gt;: OLED displays use significantly less power with dark pixels&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User preference&lt;/strong&gt;: 70%+ of developers prefer dark interfaces&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Professional appearance&lt;/strong&gt;: Dark modes are now expected in modern web apps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;BlackMagic makes implementing dark mode so trivial that there's no excuse not to offer it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Technical Achievement
&lt;/h2&gt;

&lt;p&gt;Creating truly automatic dark mode required solving several computer science challenges:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Color perception modeling&lt;/strong&gt; – Understanding how humans perceive color relationships&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accessibility mathematics&lt;/strong&gt; – Implementing WCAG contrast ratio algorithms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DOM traversal optimization&lt;/strong&gt; – Efficiently analyzing thousands of elements&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Color space conversion&lt;/strong&gt; – Accurate RGB ↔ HSL transformations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inheritance resolution&lt;/strong&gt; – Properly handling CSS cascade and computed styles&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The result is a framework that does in milliseconds what would take developers hours to implement manually.&lt;/p&gt;

&lt;h2&gt;
  
  
  Browser Support &amp;amp; Performance
&lt;/h2&gt;

&lt;p&gt;BlackMagic works flawlessly across:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Chrome 60+&lt;/li&gt;
&lt;li&gt;✅ Firefox 60+
&lt;/li&gt;
&lt;li&gt;✅ Safari 12+&lt;/li&gt;
&lt;li&gt;✅ Edge 79+&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With zero dependencies and a tiny 8KB minified footprint, BlackMagic adds negligible overhead while providing massive functionality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Source &amp;amp; Community
&lt;/h2&gt;

&lt;p&gt;BlackMagic is MIT licensed and available on GitHub. The framework includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📚 Comprehensive documentation&lt;/li&gt;
&lt;li&gt;🧪 Interactive examples and demos&lt;/li&gt;
&lt;li&gt;🔧 TypeScript definitions&lt;/li&gt;
&lt;li&gt;🚀 Professional build pipeline&lt;/li&gt;
&lt;li&gt;🤝 Contribution guidelines&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;The roadmap includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Auto-theme detection&lt;/strong&gt; based on system preferences&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom color palette integration&lt;/strong&gt; for design systems&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;React/Vue/Angular components&lt;/strong&gt; for framework integration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CSS variable synchronization&lt;/strong&gt; for hybrid approaches&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It Now
&lt;/h2&gt;

&lt;p&gt;Want to see BlackMagic in action? Check out the &lt;a href="https://github.com/LucAngevare/BlackMagic-js" rel="noopener noreferrer"&gt;demo examples&lt;/a&gt; or add it to your project in under 60 seconds. Check out the &lt;a href="https://github.com/LucAngevare/BlackMagic-js" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt; for some more information, or look at the &lt;a href="https://www.npmjs.com/package/blackmagic-js" rel="noopener noreferrer"&gt;npm package&lt;/a&gt; to see more!&lt;/p&gt;

&lt;p&gt;This isn't just another dark mode library, it's the dark mode solution the web has been waiting for.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>javascriptlibraries</category>
      <category>darkmode</category>
    </item>
  </channel>
</rss>
