Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      In-House vs. Outsource Node.js Development Teams: 9 Key Differences for the C-Suite (2025)

      July 19, 2025

      Why Non-Native Content Designers Improve Global UX

      July 18, 2025

      DevOps won’t scale without platform engineering and here’s why your teams are still stuck

      July 18, 2025

      This week in AI dev tools: Slack’s enterprise search, Claude Code’s analytics dashboard, and more (July 18, 2025)

      July 18, 2025

      I ditched my Bluetooth speakers for this slick turntable – and it’s more practical than I thought

      July 19, 2025

      This split keyboard offers deep customization – if you’re willing to go all in

      July 19, 2025

      I spoke with an AI version of myself, thanks to Hume’s free tool – how to try it

      July 19, 2025

      I took a walk with Meta’s new Oakley smart glasses – they beat my Ray-Bans in every way

      July 19, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The details of TC39’s last meeting

      July 19, 2025
      Recent

      The details of TC39’s last meeting

      July 19, 2025

      Simple wrapper for Chrome’s built-in local LLM (Gemini Nano)

      July 19, 2025

      Online Examination System using PHP and MySQL

      July 18, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Top 7 Computer Performance Test Tools Online (Free & Fast)

      July 19, 2025
      Recent

      Top 7 Computer Performance Test Tools Online (Free & Fast)

      July 19, 2025

      10 Best Windows 11 Encryption Software

      July 19, 2025

      Google Chrome Is Testing Dynamic Country Detection for Region-Specific Features

      July 19, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»How to make your images in Markdown on GitHub adjust for dark mode and light mode

    How to make your images in Markdown on GitHub adjust for dark mode and light mode

    April 18, 2025

    GitHub supports dark mode and light mode, and as developers, we can make our README images look great in both themes. Here’s a quick guide to using the <picture> element in your GitHub Markdown files to dynamically switch images based on the user’s color scheme.

    When developers switch to GitHub’s dark mode (or vice versa), standard images can look out of place, with bright backgrounds or clashing colors.

    Instead of forcing a one-size-fits-all image, you can tailor your visuals to blend seamlessly with the theme. It’s a small change, but it can make your project look much more polished.

    One snippet, two themes!

    Here’s the magic snippet you can copy into your README (or any Markdown file):

    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="dark-mode-image.png">
      <source media="(prefers-color-scheme: light)" srcset="light-mode-image.png">
      <img alt="Fallback image description" src="default-image.png">
    </picture>
    

    Now, we say it’s magic, but let’s take a peek behind the curtain to show how it works:

    • The <picture> tag lets you define multiple image sources for different scenarios.
    • The <source media="..."> attribute matches the user’s color scheme.
      • When media="(prefers-color-scheme: dark)", the browser loads the srcset image when GitHub is in dark mode.
      • Similarly, when media="(prefers-color-scheme: light)", the browser loads the srcset image when GitHub is in light mode.
    • If the browser doesn’t support the <picture> element, or the user’s system doesn’t match any defined media queries, the fallback <img> tag will be used.

    You can use this approach in your repo README files, documentation hosted on GitHub, and any other Markdown files rendered on GitHub.com!

    Demo

    What’s better than a demo to help you get started? Here’s what this looks like in practice:


    https://github.blog/wp-content/uploads/2025/04/Toggle-Dark-and-Light-Mode-on-GitHub-.mp4#t=0.001

    The post How to make your images in Markdown on GitHub adjust for dark mode and light mode appeared first on The GitHub Blog.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleImprove ImgSLI is an image comparison tool
    Next Article GoldenDict-ng is an advanced dictionary lookup program

    Related Posts

    News & Updates

    I ditched my Bluetooth speakers for this slick turntable – and it’s more practical than I thought

    July 19, 2025
    News & Updates

    This split keyboard offers deep customization – if you’re willing to go all in

    July 19, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    Safely Retry API calls in Laravel

    Development

    CVE-2025-47111 – Adobe Acrobat Reader NULL Pointer Dereference Denial of Service Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    I used Lenovo’s latest dual-screen OLED laptop for a month and it wouldn’t be my first choice — here’s why

    News & Updates

    CVE-2025-7627 – YiJiuSmile kkFileViewOfficeEdit Unrestricted File Upload Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    CVE-2025-29840 – Windows Media Stack-based Buffer Overflow Remote Code Execution

    May 13, 2025

    CVE ID : CVE-2025-29840

    Published : May 13, 2025, 5:15 p.m. | 2 hours, 44 minutes ago

    Description : Stack-based buffer overflow in Windows Media allows an unauthorized attacker to execute code over a network.

    Severity: 8.8 | HIGH

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    I’m grateful The Witcher 4 isn’t following this annoying RPG trend — a key Cyberpunk 2077 and The Witcher 3 policy lives on with the sequel

    July 1, 2025

    Samsung offers enticing preorder deal for new Galaxy foldable phones ahead of July Unpacked

    June 23, 2025

    CVE-2025-39350 – Rocket Apps wProject Missing Authorization Vulnerability

    May 19, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.