Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Light Theme #13

Merged
merged 1 commit into from
Jun 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions css/common.css
Original file line number Diff line number Diff line change
@@ -5,6 +5,21 @@ html {
body {
background-color: #2d2d30;
color: #ccc;
transition: all 2s;
}

a {
color: mediumpurple;
text-decoration: underline;
}

.light-theme {
background-color: #eee;
color: #333;
}

.light-theme a {
color: blue;
}

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

textarea {
width: 100%;
height: 100%;
min-width: 250px;
background-color: #1e1e1e;
border: none;
color: #ccc;
font-size: 1.2rem;
padding: 10px;
font-family: Consolas, monospace;
}

::placeholder {
color: #818180;
}

.left h1 {
/* padding-left: 20px; */
#text-editor-container {
transition: all 2s;
}

.instructions {
padding-right: 20px;
/* padding-left: 20px; */
font-size: 1.2rem;
}

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

a {
color: mediumpurple;
text-decoration: underline;
}

.btn-container {
display: flex;
/* margin-left: 20px; */
}

.btn {
.btn,
.light-theme .btn {
text-decoration: none;
display: flex;
align-items: center;
justify-content: center;
background-color: #555;
border: 1px #000 solid;
/* border: 1px #000 solid; */
border: none;
border-radius: 5px;
padding: 10px;
margin: 10px;
color: #eee;
font-size: 1.5rem;
cursor: pointer;
font-family: monospace;
transition: all 2s;
}

.light-theme .btn {
background-color: #fff;
color: #000;
}

.contributing p {
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -25,6 +25,9 @@ <h1>Speech Programmer</h1>
Clear Code
</button>
<a class="btn readme" href='./readme.html' target="_blank">Readme</a>
<button class="btn" id="changeThemeButton" onClick="changeTheme(event)">
Change Theme
</button>
</div>

<div class="contributing">
12 changes: 12 additions & 0 deletions js/buttonFunctions.js
Original file line number Diff line number Diff line change
@@ -24,3 +24,15 @@ function startStopButton(event) {
recognition.stop();
}
}

// function to switch between light and dark themes
function changeTheme(event) {

// add light-theme css to body
document.body.classList.toggle('light-theme');

// change theme of monaco editor with a delay
setTimeout(function() {
programTextArea._themeService.getTheme().id === 'vs vs' ? monaco.editor.setTheme('vs-dark') : monaco.editor.setTheme('vs-light');
}, 1000);
}
2 changes: 1 addition & 1 deletion js/monacoEditor.js
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@ require(["vs/editor/editor.main"], function () {
theme: 'vs-dark',
formatOnType: true,
formatOnPaste: true,
automaticLayout: true,
});


programTextArea = editor;
});