File tree Expand file tree Collapse file tree 4 files changed +36
-12
lines changed Expand file tree Collapse file tree 4 files changed +36
-12
lines changed Original file line number Diff line number Diff line change 1313</ head >
1414
1515< div class ="navbar ">
16- < img src ="images/icon.png " alt ="Logo ">
17- < a href ="https://modrinth.com/mod/axolotlclient "> Modrinth</ a >
18- < a href ="https://github.com/AxolotlClient/ "> GitHub</ a >
19- < a href ="https://discord.gg/9Q3brQVQZN "> Discord</ a >
20- < img src ="images/moon-regular.svg " alt ="" id ="switcher ">
16+ < div class ="navbar-left ">
17+ < img src ="images/icon.png " alt ="Logo ">
18+ < a href ="https://modrinth.com/mod/axolotlclient "> Modrinth</ a >
19+ < a href ="https://github.com/AxolotlClient/ "> GitHub</ a >
20+ < a href ="https://discord.gg/9Q3brQVQZN "> Discord</ a >
21+ </ div >
22+ < div class ="navbar-right "> < img src ="images/moon-regular.svg " alt ="" id ="switcher "> </ div >
2123</ div >
2224
2325< body >
Original file line number Diff line number Diff line change @@ -16,18 +16,24 @@ const rootElem = document.documentElement;
1616
1717const darkThemeMq = window . matchMedia ( "(prefers-color-scheme: dark)" ) ;
1818if ( darkThemeMq . matches ) {
19- rootElem . setAttribute ( "data-theme" , 'dark' ) ;
19+ rootElem . setAttribute ( "data-theme" , "dark" ) ;
20+ document . getElementById ( "switcher" ) . src = "images/sun-regular.svg" ;
2021} else {
21- rootElem . setAttribute ( "data-theme" , 'light' ) ;
22+ rootElem . setAttribute ( "data-theme" , "light" ) ;
23+ document . getElementById ( "switcher" ) . src = "images/moon-regular.svg" ;
2224}
2325
2426const switchTheme = ( ) => {
2527 let dataTheme = rootElem . getAttribute ( "data-theme" ) ,
2628 newtheme ;
27-
28- newTheme = ( dataTheme === "dark" ) ? "light" : "dark" ;
29-
29+ newTheme = dataTheme === "dark" ? "light" : "dark" ;
30+ switchIcon = document . getElementById ( "switcher" ) ;
3031 rootElem . setAttribute ( "data-theme" , newTheme ) ;
32+ if ( dataTheme === "dark" ) {
33+ switcher . src = "images/moon-regular.svg" ;
34+ } else {
35+ switcher . src = "images/sun-regular.svg" ;
36+ }
3137} ;
3238
3339document . querySelector ( "#switcher" ) . addEventListener ( "click" , switchTheme ) ;
Original file line number Diff line number Diff line change 3131 --scrollbar-thumb : # b0b0b0 ;
3232 --about-text : # 2a2a2a ;
3333 --about-muted : # 808080 ;
34+ --switcher-color : invert (6% ) sepia (1% ) saturate (751% ) hue-rotate (314deg )
35+ brightness (101% ) contrast (71% );
3436}
3537
3638: root {
@@ -202,8 +204,20 @@ body {
202204 margin-bottom : 10px ;
203205}
204206
207+ .navbar-left ,
208+ .navbar-right {
209+ display : flex;
210+ align-items : center;
211+ justify-content : space-between;
212+ }
213+
205214.navbar {
206215 transition : var (--default-transition );
216+ justify-content : space-between;
217+ display : flex;
218+ align-items : center;
219+ display : flex;
220+ align-items : center;
207221 backdrop-filter : blur (5px );
208222 z-index : 1 ;
209223 overflow : hidden;
@@ -225,7 +239,7 @@ body {
225239
226240.navbar img {
227241 padding : 10px ;
228- float : left ;
242+ height : 40 px ;
229243 width : 40px ;
230244}
231245
@@ -235,10 +249,11 @@ body {
235249}
236250
237251# switcher {
238- transition : .3s 5ms ;
252+ transition : 0 .3s 5ms ;
239253 filter : var (--switcher-color );
240254 float : right;
241255 width : 25px ;
256+ margin : 2px ;
242257 cursor : pointer;
243258}
244259
You can’t perform that action at this time.
0 commit comments