Skip to content

Commit

Permalink
Change default theme to honor dark/light mode (proginosko#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
proginosko committed Feb 26, 2023
1 parent a6f8d99 commit 52dcc25
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 9 deletions.
2 changes: 1 addition & 1 deletion blocked.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function processBlockInfo(info) {
// Set theme
let link = document.getElementById("themeLink");
if (link) {
link.href = info.theme ? `/themes/${info.theme}.css` : "";
link.href = "/themes/" + (info.theme ? `${info.theme}.css` : "default.css");
}
}

Expand Down
2 changes: 1 addition & 1 deletion common.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ function createAccessCode(len) {
function setTheme(theme) {
let link = document.getElementById("themeLink");
if (link) {
link.href = theme ? `/themes/${theme}.css` : "";
link.href = "/themes/" + (theme ? `${theme}.css` : "default.css");
}
}

Expand Down
2 changes: 1 addition & 1 deletion content.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* LeechBlock content CSS style */
/* LeechBlock content overlay style */

.leechblock-timer {
z-index: 2147483647;
Expand Down
2 changes: 1 addition & 1 deletion options.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* LeechBlock options CSS style */
/* LeechBlock options style */

html {
overflow-y: scroll;
Expand Down
1 change: 1 addition & 0 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@
<label>Theme:</label>
<select id="theme">
<option value="">Default</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
<option value="spruce">Spruce</option>
</select>
Expand Down
2 changes: 1 addition & 1 deletion popup.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* LeechBlock popup CSS style */
/* LeechBlock popup style */

body {
background-color: #fff;
Expand Down
2 changes: 1 addition & 1 deletion popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function initializePage() {
let theme = options["theme"];
let link = document.getElementById("themeLink");
if (link) {
link.href = theme ? `/themes/${theme}.css` : "";
link.href = "/themes/" + (theme ? `${theme}.css` : "default.css");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* LeechBlock CSS style */
/* LeechBlock blocking/delaying page style */

body {
background: #fff;
Expand Down
2 changes: 1 addition & 1 deletion themes/dark.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* LeechBlock Dark theme CSS style */
/* LeechBlock Dark theme style */

body {
background: #222;
Expand Down
114 changes: 114 additions & 0 deletions themes/default.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/* LeechBlock Default theme style */

@media (prefers-color-scheme: dark) {

/* The following should replicate the Dark theme style */

body {
background: #222;
color: #bbb;
}

.ui-button {
background: #444;
color: #bbb;
border: 1px solid #666;
}

.ui-button:focus {
background: #444;
color: #bbb;
border: 1px solid #666;
}

.ui-button:hover {
background: #333;
color: #bbb;
border: 1px solid #666;
}

.ui-widget button {
background: #444;
color: #bbb;
border: 1px solid #666;
}

.ui-widget button:hover:enabled {
background: #333;
}

.ui-widget button:disabled {
background: #333;
color: #666;
border: 1px solid #444;
}

.ui-widget fieldset, .ui-widget input, .ui-widget select, .ui-widget textarea {
background: #222;
color: #bbb;
border: 1px solid #666;
}

.ui-widget input:disabled, .ui-widget select:disabled, .ui-widget textarea:disabled {
background: #333;
color: #666;
border: 1px solid #444;
}

.ui-widget hr {
height: 0px;
margin: 0px;
border-top: none;
border-left: none;
border-right: none;
border-bottom: 1px solid #666;
}

.ui-widget th, td {
border: 1px solid #666;
}

.ui-widget-header {
background: #444;
color: #bbb;
border: 1px solid #888;
}

.ui-widget-content {
background: #222;
color: #bbb;
border: 1px solid #888;
}

.ui-widget.ui-widget-content {
border: 1px solid #888;
}

.ui-tabs .ui-state-default {
background: #aaa;
border: 1px solid #666;
}

.ui-tabs .ui-state-default a {
color: #000;
}

.ui-tabs .ui-state-hover {
background: #999;
border: 1px solid #666;
}

.ui-tabs .ui-state-active {
background: #222;
border: 1px solid #666;
}

.ui-tabs .ui-state-active a {
color: #bbb;
}

#paneAbout {
color: #bbb;
}

}
1 change: 1 addition & 0 deletions themes/light.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* LeechBlock Light theme style */
2 changes: 1 addition & 1 deletion themes/spruce.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* LeechBlock Spruce theme CSS style */
/* LeechBlock Spruce theme style */

body {
background: #031;
Expand Down

0 comments on commit 52dcc25

Please sign in to comment.