---
title: "Discussion on \"Automatic Dark/Light Theme Switching Based On The Environment Lighting\" | Hashnode"
description: "Discussion on \"Automatic Dark/Light Theme Switching Based On The Environment Lighting\". Hello beautiful people ! In this article I will show you how to automatically switch to dark/light theme based on ambient light levels using Ambient Light Sensor API.\nWhat is Ambient Light Sensor API ?\nThe Ambient Light Sensor API allows web applicat..."
url: "https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Automatic Dark/Light Theme Switching Based On The Environment Lighting](https://geeky-chakri.hashnode.dev/automatic-darklight-theme-switching-based-on-the-environment-lighting?utm_source=hashnode&utm_medium=feed)

Hello beautiful people ! In this article I will show you how to automatically switch to dark/light theme based on ambient light levels using Ambient Light Sensor API. What is Ambient Light Sensor API ? The Ambient Light Sensor API allows web applicat...

May 27, 2021 · 3 min read · geeky-chakri.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#theme](https://hashnode.com/tag/theme)
-   [#web-api](https://hashnode.com/tag/web-api)
-   [#apis](https://hashnode.com/tag/apis)
-   [#chrome](https://hashnode.com/tag/chrome)

## Written by

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

@GeekyChakri

  
[View profile](https://hashnode.com/@GeekyChakri)

I ❤️️ building things for the web.

## Responses 10

Markdown supported · ⌘↵ to post

[A K Singh Rajpoot](https://hashnode.com/@aksinghrajpoot)

[Jun 2, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b763eb2102c86fd6d182d5)

@geekychakri Wow 😮, It's great , Thanks for sharing it with us & keep up the great work

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

[Jun 5, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b763eb2102c86fd6d182d5#reply-60bb1a84e36d51141c95a5de)

My pleasure. Thanks [A K Singh Rajpoot](https://hashnode.com/@aksinghrajpoot) 😃

[Suprabha Supi](https://hashnode.com/@suprabhasupi)

[May 29, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b212b49b1e2e1dccbce602)

This was awesome, I will also give it a try 😍 Ty

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

[Jun 5, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b212b49b1e2e1dccbce602#reply-60bb1976e36d51141c95a5a6)

Thank you [Suprabha Supi](https://hashnode.com/@suprabhasupi) 😃

[Tapas Adhikary](https://hashnode.com/@atapas)

[May 29, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b1bc1dfb51fd32a4dbfa7f)

Excellent! I'm very glad to see more and more practical articles coming out on JavaScript Web APIs. Thanks for making it. Good work.

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

[May 29, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b1bc1dfb51fd32a4dbfa7f#reply-60b1e3b5fb51fd32a4dbfcfc)

I appreciate your kind words. Thank you [Tapas Adhikary](https://hashnode.com/@atapas) 😃

[Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b0e92f9b1e2e1dccbcc9cf)

As other people already mentioned: this is a great idea [Geeky Chakri](https://hashnode.com/@GeekyChakri)

Thank you for sharing.

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b0e92f9b1e2e1dccbcc9cf#reply-60b125cc9b1e2e1dccbcd419)

You're welcome, [Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou) ! Thanks a lot 🤩

[Shree krishna lamichhane](https://hashnode.com/@uniksk)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b0dd869b1e2e1dccbcc7fd)

Great One. Thanks for the article.

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b0dd869b1e2e1dccbcc7fd#reply-60b1232a9b1e2e1dccbcd3d2)

You're welcome, [Shree krishna lamichhane](https://hashnode.com/@uniksk). Thanks 😃

[Xavier](https://hashnode.com/@anniexavier)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b0c0979b1e2e1dccbcc538)

Great work! Enjoyed using the API, more power to you!

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b0c0979b1e2e1dccbcc538#reply-60b1227b9b1e2e1dccbcd3be)

Thanks [Xavier](https://hashnode.com/@anniexavier) 😃

[Victoria Lo](https://hashnode.com/@victoria)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b0a61c9b1e2e1dccbcc267)

Loved your project on Twitter and will repeat it here: This is amazing!!! 👏👏

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b0a61c9b1e2e1dccbcc267#reply-60b1221c9b1e2e1dccbcd3b4)

Thank you so much [Victoria Lo](https://hashnode.com/@victoria) 🤩

[Saurabh Mhatre](https://hashnode.com/@saurabhmhtr)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b08c569b1e2e1dccbcc01b)

Learnt about a new web API today thanks to this article. Keep up the great work.

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b08c569b1e2e1dccbcc01b#reply-60b121abfb51fd32a4dbf1e5)

Thanks [Saurabh Mhatre](https://hashnode.com/@saurabhmhtr) 😃

[Catalin Pit](https://hashnode.com/@Catalinpit)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b0803c5c02001765cf5142)

This is really cool! Good job, [Geeky Chakri](https://hashnode.com/@GeekyChakri)!

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b0803c5c02001765cf5142#reply-60b120959b1e2e1dccbcd38f)

Thank you [Catalin Pit](https://hashnode.com/@Catalinpit) 🤩

[Savio Martin](https://hashnode.com/@saviomartin)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b07b7b9b1e2e1dccbcbe2d)

Thanks for the amazing content [Geeky Chakri](https://hashnode.com/@GeekyChakri)! Pretty sure, this will help me a lot in my future projects! Thanks! 👏✌️

[Geeky Chakri](https://hashnode.com/@GeekyChakri)

[May 28, 2021](https://hashnode.com/posts/automatic-darklight-theme-switching-based-on-the-environment-lighting/60afa01b5c02001765cf4419/comment/60b07b7b9b1e2e1dccbcbe2d#reply-60b1203f9b1e2e1dccbcd384)

You're welcome, [Savio Martin](https://hashnode.com/@saviomartin). Looking forward to your future projects.
