Commit eb50046 1 parent e102a2f commit eb50046 Copy full SHA for eb50046
File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 4
4
< head >
5
5
< meta charset ="UTF-8 ">
6
6
< meta name ="viewport " content ="width=device-width, initial-scale=1 ">
7
+ < meta name ="theme-color " content ="white ">
7
8
< title > Note</ title >
8
9
< style >
9
10
@import url ('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap' );
10
11
11
12
html ,
12
- body ,
13
- textarea {
13
+ body {
14
14
margin : 0 ;
15
15
padding : 0 ;
16
16
height : 100% ;
21
21
width : 90% ;
22
22
height : 90% ;
23
23
padding : 5% ;
24
+ margin : 0 ;
24
25
border : none;
25
26
resize : none;
26
27
outline : none;
28
+ background-color : transparent;
27
29
}
28
30
</ style >
29
31
</ head >
30
32
31
33
< body >
32
- < textarea placeholder ="Click here to type "> </ textarea >
34
+ < textarea placeholder ="Click here to type. Type dark to activate dark mode. Reload to set to light. Type Clear to delete all data. "> </ textarea >
33
35
< script >
34
36
const text = document . querySelector ( 'textarea' ) ;
35
37
text . value = localStorage . getItem ( 'key' ) ;
36
38
text . oninput = ( ) => {
37
39
localStorage . setItem ( 'key' , text . value ) ;
40
+ if ( text . value == 'dark' ) {
41
+ document . body . style . backgroundColor = 'black' ;
42
+ document . querySelector ( 'meta[name="theme-color"]' ) . setAttribute ( "content" , 'black' ) ;
43
+ text . style . color = 'white' ;
44
+ }
45
+ if ( text . value == 'Clear' ) {
46
+ localStorage . clear ( ) ;
47
+ location . reload ( ) ;
48
+ }
38
49
}
39
50
</ script >
40
51
</ body >
You can’t perform that action at this time.
0 commit comments