Skip to content

Commit

Permalink
Automatic dark/light mode
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Meyer <[email protected]>
  • Loading branch information
imeyer committed Sep 13, 2024
1 parent 48e0df8 commit b57900c
Showing 1 changed file with 62 additions and 16 deletions.
78 changes: 62 additions & 16 deletions static/style.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,64 @@
/* Variables */
:root {
/* Common variables */
--border: 1px solid grey;
--primary-color: #B56484;
--background-color: #dfdfdf;
--even-row-color: #CCC;
--odd-row-color: #DDD;
--header-color: #efefef;

/* Light mode variables */
--background-color-light: #dfdfdf;
--even-row-color-light: #CCC;
--odd-row-color-light: #DDD;
--header-color-light: #efefef;
--text-color-light: #333;
--text-color-secondary-light: #555;
--form-bg-light: #ddd;
--content-bg-light: #f9f9f9;
--threadpost-bg-light: #fff;

/* Dark mode variables */
--background-color-dark: #222;
--even-row-color-dark: #444;
--odd-row-color-dark: #333;
--header-color-dark: #2c2c2c;
--text-color-dark: #e0e0e0;
--text-color-secondary-dark: #b0b0b0;
--form-bg-dark: #333;
--content-bg-dark: #2c2c2c;
--threadpost-bg-dark: #333;

/* Default to light mode */
--background-color: var(--background-color-light);
--even-row-color: var(--even-row-color-light);
--odd-row-color: var(--odd-row-color-light);
--header-color: var(--header-color-light);
--text-color: var(--text-color-light);
--text-color-secondary: var(--text-color-secondary-light);
--form-bg: var(--form-bg-light);
--content-bg: var(--content-bg-light);
--threadpost-bg: var(--threadpost-bg-light);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
:root {
--background-color: var(--background-color-dark);
--even-row-color: var(--even-row-color-dark);
--odd-row-color: var(--odd-row-color-dark);
--header-color: var(--header-color-dark);
--text-color: var(--text-color-dark);
--text-color-secondary: var(--text-color-secondary-dark);
--form-bg: var(--form-bg-dark);
--content-bg: var(--content-bg-dark);
--threadpost-bg: var(--threadpost-bg-dark);
}
}

/* Base styles */
body {
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-size: 100%;
background-color: var(--background-color);
color: var(--text-color);
margin: 0;
padding: 20px;
}
Expand Down Expand Up @@ -156,12 +202,12 @@ tbody>tr:nth-child(odd) {
.version {
font: x-small 'Courier New', Courier, monospace;
padding: 5px;
color: rgb(46, 43, 43);
color: var(--text-color-secondary);
}

/* Thread post styles */
.threadpost-bubble {
background-color: #fff;
background-color: var(--threadpost-bg);
border-radius: 15px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
margin: 10px 0;
Expand All @@ -171,23 +217,23 @@ tbody>tr:nth-child(odd) {
}

.threadpost-header {
border-bottom: 1px solid #e0e0e0;
border-bottom: 1px solid var(--text-color-secondary);
width: 100%;
padding-bottom: 5px;
margin-bottom: 5px;
font-size: 1em;
color: #555;
color: var(--text-color-secondary);
}

.threadpost-body {
width: 100%;
font-size: 1.1em;
color: #333;
color: var(--text-color);
}

/* Form styles */
.form-container {
background-color: #ddd;
background-color: var(--form-bg);
padding: 20px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
Expand All @@ -202,18 +248,19 @@ tbody>tr:nth-child(odd) {
.form-group label {
display: block;
margin-bottom: 5px;
color: #555;
color: var(--text-color-secondary);
}

.form-group textarea {
box-sizing: border-box;
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border: 1px solid var(--text-color-secondary);
border-radius: 5px;
font-size: 0.9em;
resize: none;
color: #555;
color: var(--text-color);
background-color: var(--background-color);
}

.form-group textarea:focus {
Expand All @@ -237,7 +284,6 @@ tbody>tr:nth-child(odd) {
background-color: #bb509b;
}


.info-column {
padding: 10px;
}
Expand All @@ -252,8 +298,8 @@ tbody>tr:nth-child(odd) {
.content-row {
margin-bottom: 10px;
padding: 10px;
background-color: #f9f9f9;
border: 1px solid #eee;
background-color: var(--content-bg);
border: 1px solid var(--text-color-secondary);
}

.thread-content-row {
Expand Down

0 comments on commit b57900c

Please sign in to comment.