File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 3
3
< head >
4
4
< meta charset ="utf-8 ">
5
5
< title > Codever</ title >
6
- < link rel ="icon " type ="image/x-icon " href ="assets/logo/logo-blue.svg " style ="color: yellow ">
6
+ < link id ="favicon " rel ="icon " type ="image/x-icon " href ="assets/logo/logo-black.svg ">
7
+ < script type ="text/javascript ">
8
+ if ( window . matchMedia && window . matchMedia ( '(prefers-color-scheme: no-preference)' ) . matches ) {
9
+ document . getElementById ( "favicon" ) . href = "assets/logo/logo-blue.svg" ;
10
+ }
11
+ if ( window . matchMedia && window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ) {
12
+ document . getElementById ( "favicon" ) . href = "assets/logo/logo-white.svg" ;
13
+ }
14
+ window . matchMedia ( '(prefers-color-scheme: dark)' ) . addEventListener ( 'change' , e => {
15
+ const newColorScheme = e . matches ? "dark" : "light" ;
16
+ if ( newColorScheme == "dark" ) {
17
+ document . getElementById ( "favicon" ) . href = "assets/logo/logo-white.svg" ;
18
+ }
19
+ if ( newColorScheme == "light" ) {
20
+ document . getElementById ( "favicon" ) . href = "assets/logo/logo-black.svg" ;
21
+ }
22
+ } ) ;
23
+ </ script >
7
24
< link rel ="stylesheet " href ="https://use.fontawesome.com/releases/v5.7.1/css/all.css "
8
25
integrity ="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr " crossorigin ="anonymous ">
9
26
You can’t perform that action at this time.
0 commit comments