This repository was archived by the owner on Feb 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,10 +80,6 @@ body {
8080 margin : 0 auto;
8181}
8282
83- label {
84- user-select : none;
85- }
86-
8783hr {
8884 border-style : solid;
8985}
@@ -135,13 +131,7 @@ svg .text-shadow {
135131 color : var (--background );
136132}
137133
138- .header {
139- display : flex;
140- flex-direction : row;
141- justify-content : space-between;
142- margin-bottom : 1rem ;
143- }
144-
145- .header h1 {
146- margin : 0 ;
134+ /* We'll set this ourselves with tailwind utilities. */
135+ .prose h1 {
136+ margin : inherit !important ;
147137}
Original file line number Diff line number Diff line change @@ -18,7 +18,9 @@ const toggleElements = document.querySelectorAll('.toggle')
1818// Listen to the color mode and update the UI.
1919mode . subscribe ( ( v ) => {
2020 toggleElements . forEach (
21- ( el ) => ( el . textContent = v === 'dark' ? 'π Dark' : 'π Light' ) ,
21+ ( el ) =>
22+ ( el . querySelector ( '.label' ) . textContent =
23+ v === 'dark' ? 'π Dark' : 'π Light' ) ,
2224 )
2325 changeFavicon ( v === 'dark' ? 'moon.png' : 'sun.png' )
2426} )
Original file line number Diff line number Diff line change 1313 style
1414 include ./index.css
1515 body.prose
16- div.header
17- h1 ππ Perfect Dark Mode
18- button.toggle ( style ="visibility: hidden;" ) π color mode
16+ div.header.flex.items-center.mb-3.justify-between.flex-col ( class ="md:flex-row" )
17+ h1( class ="mb-3 md:mb-0" ) ππ Perfect Dark Mode
18+ button.toggle.flex.flex-col.items-center ( style ="visibility: hidden;" )
19+ span.label π color mode
20+ span.text-xs (Click Me)
1921
20- div.flex.space-x-2
22+ div.flex.space-x-2.justify-center ( class = "md:justify-start" )
2123 a.badge ( href ='https://www.npmjs.com/package/perfect-dark-mode' target ="blank" rel ="noopener" )
2224 + badge("npm" , version)
2325 a.badge ( href ='https://bundlephobia.com/result?p=perfect-dark-mode' target ="blank" rel ="noopener" )
4143 // For users with JS disabled there will not be a color mode toggle, they can change
4244 // their system color mode.
4345 p You can set the color mode, this will be saved.
44- button.toggle ( style ="visibility: hidden;" ) π color mode
46+ button.toggle ( style ="visibility: hidden;" )
47+ span.label π color mode
4548 p You can reset the color mode and fallback to system color mode.
4649 button( id ="button" ) Reset
4750 p For debugging and understanding here is the saved color mode and the OS color mode.
You canβt perform that action at this time.
0 commit comments