Skip to content

Commit

Permalink
style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NotLe0n committed Jun 14, 2024
1 parent ab0fd2c commit 0a07b5f
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 52 deletions.
18 changes: 0 additions & 18 deletions static/css/dark-mode.css

This file was deleted.

18 changes: 0 additions & 18 deletions static/css/light-mode.css

This file was deleted.

36 changes: 35 additions & 1 deletion static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ abbr {

:root {
color: var(--text-color);

--text-color: white;
--background-color: #1e1e1e;

--input-background-color: #383838;
--input-border-color: #5c5c5c;

--output-background-color: #1a1a1a;

--controls-background-color: #292929;
--controls-btn-hover-color: #969696;

--spacer-background-color: #3c3c3c;

--invert-if-dark: invert();

--input-height: 20px;
--input-border-width: 1px;

Expand Down Expand Up @@ -77,6 +93,24 @@ html, body {
height: 100%;
background-color: var(--background-color);
font-family: Arial, Helvetica, sans-serif;
overflow: hidden;
}

html[light] {
--text-color: #454545;
--background-color: #fafafa;

--input-background-color: #f4f4f5;
--input-border-color: #b0b0b0;

--output-background-color: #ffffff;

--controls-background-color: #eeeeee;
--controls-btn-hover-color: #c6c6c6;

--spacer-background-color: #d0d7de;

--invert-if-dark: none;
}

input {
Expand All @@ -95,7 +129,6 @@ main {
display: grid;
grid-template-columns: var(--editor-container-size) var(--spacer-width) calc(100% - var(--editor-container-size) - var(--spacer-width));
grid-template-rows: 100%;
overscroll-behavior: none;
}

main[horizontal] {
Expand Down Expand Up @@ -129,6 +162,7 @@ img[active] {
}

.controls img.btn {
filter: var(--invert-if-dark);
border-radius: 30%;
}

Expand Down
2 changes: 0 additions & 2 deletions static/html/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

<link rel="stylesheet" data-name="vs/editor/editor.main" href="monaco-editor/min/vs/editor/editor.main.css">
<link rel="stylesheet" type="text/css" href="static/css/style.css">
<link id="dark" rel="stylesheet" href="static/css/dark-mode.css" media="all">
<link id="light" rel="stylesheet" href="static/css/light-mode.css" media="not all">

<script>var embedded = true;</script>
<script defer>
Expand Down
2 changes: 0 additions & 2 deletions static/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

<link rel="stylesheet" data-name="vs/editor/editor.main" href="monaco-editor/min/vs/editor/editor.main.css">
<link rel="stylesheet" type="text/css" href="static/css/style.css">
<link id="dark" rel="stylesheet" href="static/css/dark-mode.css" media="all">
<link id="light" rel="stylesheet" href="static/css/light-mode.css" media="not all">

<script>var embedded = false;</script>
<script defer>
Expand Down
9 changes: 3 additions & 6 deletions static/js/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,13 @@ function share() {
}

function toggleDarkMode() {
let isDark = document.getElementById('dark').media === 'all';
if (isDark) {
document.getElementById('dark').media = 'not all';
document.getElementById('light').media = 'all';
document.querySelector('html').toggleAttribute('light')

if (document.querySelector('html').hasAttribute('light')) {
monaco.editor.setTheme("ddp-theme-light");
window.localStorage.setItem("dark-mode", "false");
}
else {
document.getElementById('dark').media = 'all';
document.getElementById('light').media = 'not all';
monaco.editor.setTheme("ddp-theme-dark");
window.localStorage.setItem("dark-mode", "true");
}
Expand Down
6 changes: 1 addition & 5 deletions static/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ if (urlParams.has("code")) {
let editorTheme = 'ddp-theme-dark';
if (window.localStorage.getItem("dark-mode") === 'false' || urlParams.has('light')) {
editorTheme = "ddp-theme-light";
document.getElementById('dark').media = 'not all';
document.getElementById('light').media = 'all';
} else {
document.getElementById('dark').media = 'all';
document.getElementById('light').media = 'not all';
document.querySelector('html').setAttribute('light', '')
}

const isReadOnly = urlParams.has("readonly");
Expand Down

0 comments on commit 0a07b5f

Please sign in to comment.