Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

tailwind css dark mode

<div class="bg-white dark:bg-gray-800">
  <h1 class="text-gray-900 dark:text-white">Dark Mode!!</h1>
  <p class="text-gray-600 dark:text-gray-300">
    Example Text
  </p>
</div>

<script>
  // Change in Tailwinds Config.
  module.exports = {
  darkMode: 'media',
}
</script>
Comment

Setting darkmode using Tailwind

<script>
    // On page load or when changing themes, best to add inline in `head` to avoid FOUC
    if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
        document.documentElement.classList.add('dark');
    } else {
        document.documentElement.classList.remove('dark')
    }
</script>
Comment

tailwind dark mode class

module.exports = {
  darkMode: 'class',
  // ...
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: move last element of array to beginning javascript 
Javascript :: scroll up link 
Javascript :: Regular Expressions: Extract Matches 
Javascript :: min max value javascript 
Javascript :: ?? in javascript 
Javascript :: mdn trim 
Javascript :: how to use fetch in gatsby 
Javascript :: angular9 spy 
Javascript :: String operators in JavaScript 
Javascript :: how to use mui 
Javascript :: javascript floating point addition 
Javascript :: jquery form validation 
Javascript :: javascript string spaces replace with %20 
Javascript :: como percorrer um objeto js 
Javascript :: autocannon 
Javascript :: sort array based on multiple columns javascript 
Javascript :: object literal js 
Javascript :: query parameters 
Javascript :: Math max with array js 
Javascript :: return object from map javascript 
Javascript :: .includes meaning in javascript 
Javascript :: convert a signed 64.64 bit fixed point number online 
Javascript :: datatable dropdown toggle not working 
Javascript :: regex not a value 
Javascript :: mock createRef jest react functional component 
Javascript :: show selected image input file from database 
Javascript :: odd even condition 
Javascript :: react snack bar 
Javascript :: what is symbol in javascript 
Javascript :: hash url owl carousel example 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =