File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 11# Dark mode  
22
3- On page load we load the correct theme stylesheet in ` templates/head.html.twig `  based on the variable  ` theme.current  ` . 
4- We also use that variable to show the correct logo in ` templates/navigation.html.twig ` .
3+ On page load we load the correct theme stylesheet in ` templates/head.html.twig `  based on the result of the  ` theme()  `   
4+ twig function.  We also use that variable to show the correct logo in ` templates/navigation.html.twig ` .
55
66First time on the application we show the theme based on the users OS preferences.
77Later when the user uses the theme switcher in the navigation, we set a cookie with the theme chosen in Javascript.
@@ -10,7 +10,7 @@ Later when the user uses the theme switcher in the navigation, we set a cookie w
1010## Disabled dark mode  
1111
1212-  Remove the import of ` Theme `  from ` imports.js ` 
13- -  Remove all ` theme.current  `  if statements and remove the dark mode code.
13+ -  Remove all ` theme()  `  if statements and remove the dark mode code.
1414    -  Remove dark mode logo and if statements on the light mode logo in ` templates/navigation.html.twig ` 
1515    -  Remove dark mode ` encore_entry_link_tags `  and if statement around it in ` templates/head.html.twig ` 
1616-  Hide the div with class ` .dark-mode-switch `  to hide the dark mode toggle.
Original file line number Diff line number Diff line change 66
77<div  class =" d-flex justify-content-end mt-3 me-3" 
88  <div  class =" form-check dark-mode-switch" data-theme-toggler-wrapper >
9-     <input  type =" checkbox" class =" form-check-input" id =" dark-mode" data-theme-toggler {% if  theme . current  ==  ' theme-dark' checked =" checked" endif  %}>
9+     <input  type =" checkbox" class =" form-check-input" id =" dark-mode" data-theme-toggler {% if  theme()  ==  ' theme-dark' checked =" checked" endif  %}>
1010    <label  class =" form-check-label" for =" dark-mode" ' core.themes.dark' | trans| ucfirst }} {{ ' core.themes.themes' | trans }}</label >
1111  </div >
1212</div >
1717      <div  class =" card p-4 mt-5" 
1818        <div  class =" text-center mb-3 py-5 px-sm-4 px-md-5" 
1919          {% block  logo_image  %}
20-             <img  class =" img-responsive{% if  theme . current  !=  ' theme-dark' endif  %}" data-navbar-logo-dark  src =" {{ asset(' build/images/logo-application-dark.svg' " alt =" {{ fallbacks.get (' site_title' " 
21-             <img  class =" img-responsive{% if  theme . current  ==  ' theme-dark' endif  %}" data-navbar-logo  src =" {{ asset(' build/images/logo-application.svg' " alt =" {{ fallbacks.get (' site_title' " 
20+             <img  class =" img-responsive{% if  theme()  !=  ' theme-dark' endif  %}" data-navbar-logo-dark  src =" {{ asset(' build/images/logo-application-dark.svg' " alt =" {{ fallbacks.get (' site_title' " 
21+             <img  class =" img-responsive{% if  theme()  ==  ' theme-dark' endif  %}" data-navbar-logo  src =" {{ asset(' build/images/logo-application.svg' " alt =" {{ fallbacks.get (' site_title' " 
2222          {% endblock  %}
2323        </div >
2424
Original file line number Diff line number Diff line change 1818        <li >
1919          <div  class =" dropdown-item" 
2020            <div  class =" form-check dark-mode-switch" data-theme-toggler-wrapper >
21-               <input  type =" checkbox" class =" form-check-input" id =" dark-mode{% if  mobile  %}-mobile{% endif  %}" data-theme-toggler {% if  theme . current  ==  ' theme-dark' checked =" checked" endif  %}>
21+               <input  type =" checkbox" class =" form-check-input" id =" dark-mode{% if  mobile  %}-mobile{% endif  %}" data-theme-toggler {% if  theme()  ==  ' theme-dark' checked =" checked" endif  %}>
2222              <label  class =" form-check-label" for =" dark-mode{% if  mobile  %}-mobile{% endif  %}" ' core.themes.dark' | trans| ucfirst }} {{ ' core.themes.themes' | trans }}</label >
2323            </div >
2424          </div >
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments