Skip to content

Commit 099b2a7

Browse files
committedJun 5, 2020
Light Theme
1 parent b5ca7f0 commit 099b2a7

File tree

4 files changed

+43
-28
lines changed

4 files changed

+43
-28
lines changed
 

‎css/common.css

+27-27
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ html {
55
body {
66
background-color: #2d2d30;
77
color: #ccc;
8+
transition: all 2s;
9+
}
10+
11+
a {
12+
color: mediumpurple;
13+
text-decoration: underline;
14+
}
15+
16+
.light-theme {
17+
background-color: #eee;
18+
color: #333;
19+
}
20+
21+
.light-theme a {
22+
color: blue;
823
}
924

1025
.half-screen {
@@ -25,29 +40,12 @@ body {
2540
height: 95vh;
2641
}
2742

28-
textarea {
29-
width: 100%;
30-
height: 100%;
31-
min-width: 250px;
32-
background-color: #1e1e1e;
33-
border: none;
34-
color: #ccc;
35-
font-size: 1.2rem;
36-
padding: 10px;
37-
font-family: Consolas, monospace;
38-
}
39-
40-
::placeholder {
41-
color: #818180;
42-
}
43-
44-
.left h1 {
45-
/* padding-left: 20px; */
43+
#text-editor-container {
44+
transition: all 2s;
4645
}
4746

4847
.instructions {
4948
padding-right: 20px;
50-
/* padding-left: 20px; */
5149
font-size: 1.2rem;
5250
}
5351

@@ -65,30 +63,32 @@ textarea {
6563
padding: 1rem;
6664
}
6765

68-
a {
69-
color: mediumpurple;
70-
text-decoration: underline;
71-
}
72-
7366
.btn-container {
7467
display: flex;
75-
/* margin-left: 20px; */
7668
}
7769

78-
.btn {
70+
.btn,
71+
.light-theme .btn {
7972
text-decoration: none;
8073
display: flex;
8174
align-items: center;
8275
justify-content: center;
8376
background-color: #555;
84-
border: 1px #000 solid;
77+
/* border: 1px #000 solid; */
78+
border: none;
8579
border-radius: 5px;
8680
padding: 10px;
8781
margin: 10px;
8882
color: #eee;
8983
font-size: 1.5rem;
9084
cursor: pointer;
9185
font-family: monospace;
86+
transition: all 2s;
87+
}
88+
89+
.light-theme .btn {
90+
background-color: #fff;
91+
color: #000;
9292
}
9393

9494
.contributing p {

‎index.html

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ <h1>Speech Programmer</h1>
2525
Clear Code
2626
</button>
2727
<a class="btn readme" href='./readme.html' target="_blank">Readme</a>
28+
<button class="btn" id="changeThemeButton" onClick="changeTheme(event)">
29+
Change Theme
30+
</button>
2831
</div>
2932

3033
<div class="contributing">

‎js/buttonFunctions.js

+12
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,15 @@ function startStopButton(event) {
2424
recognition.stop();
2525
}
2626
}
27+
28+
// function to switch between light and dark themes
29+
function changeTheme(event) {
30+
31+
// add light-theme css to body
32+
document.body.classList.toggle('light-theme');
33+
34+
// change theme of monaco editor with a delay
35+
setTimeout(function() {
36+
programTextArea._themeService.getTheme().id === 'vs vs' ? monaco.editor.setTheme('vs-dark') : monaco.editor.setTheme('vs-light');
37+
}, 1000);
38+
}

‎js/monacoEditor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ require(["vs/editor/editor.main"], function () {
2020
theme: 'vs-dark',
2121
formatOnType: true,
2222
formatOnPaste: true,
23+
automaticLayout: true,
2324
});
2425

25-
2626
programTextArea = editor;
2727
});

0 commit comments

Comments
 (0)
Please sign in to comment.