Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Invert icons and logo with theme change

Scott Petrovicd2d6b1a73184
diff --git a/src/index.html b/src/index.html
index cb78263..053941a 100644
--- a/src/index.html
+++ b/src/index.html
@@ -37,7 +37,8 @@
<!-- Theme Toggle -->
<div id="theme-toggle-container">
<button id="theme-toggle">
- <span class="theme-icon">🌝</span>
+ <!-- icon will fill in here-->
+ <span class="theme-icon"></span>
</button>
</div>
diff --git a/src/lib/ThemeManager.ts b/src/lib/ThemeManager.ts
index 26cf5b4..1c1abb8 100644
--- a/src/lib/ThemeManager.ts
+++ b/src/lib/ThemeManager.ts
@@ -43,11 +43,16 @@ export class ThemeManager extends EventTarget {
private apply_theme (): void {
const html_element = document.documentElement
+ const body_element = document.body
if (this.current_theme === 'light') {
html_element.setAttribute('data-theme', 'light')
+ body_element.classList.add('light-theme')
+ body_element.classList.remove('dark-theme')
} else {
html_element.removeAttribute('data-theme')
+ body_element.classList.add('dark-theme')
+ body_element.classList.remove('light-theme')
}
this.update_toggle_ui()
@@ -56,9 +61,9 @@ export class ThemeManager extends EventTarget {
private update_toggle_ui (): void {
if (this.theme_icon !== null) {
if (this.current_theme === 'light') {
- this.theme_icon.textContent = '😎'
+ this.theme_icon.textContent = '🌞'
} else {
- this.theme_icon.textContent = '🌝'
+ this.theme_icon.textContent = '🌚'
}
}
}
diff --git a/src/radio-button-group.css b/src/radio-button-group.css
index af17b0d..98f0906 100644
--- a/src/radio-button-group.css
+++ b/src/radio-button-group.css
@@ -1,12 +1,3 @@
-:root {
- --primary-color: #496987;
-}
-
-/* Light theme override for radio buttons */
-[data-theme="light"] {
- --primary-color: #3498db;
-}
-
fieldset {
border: none;
margin: 0;
@@ -37,7 +28,7 @@ fieldset {
.toggle input + label {
padding: .25rem 0.5rem;
padding-top: 0.5rem;
- border: solid 2px var(--primary-color);
+ border: solid 2px var(--radio-button-group-bg);
font-size: 1rem;
transition: border-color .15s ease-out,
color .25s ease-out,
@@ -57,14 +48,14 @@ fieldset {
/* border color when hovering over the element */
.toggle input:hover + label {
- border-color: var(--primary-color);
- background: #5482ad70;
+ border-color: var(--radio-button-group-bg);
+ background: var(--radio-button-group-hover);
}
/* active state */
.toggle input:checked + label {
- background-color: var(--primary-color);
+ background-color: var(--radio-button-group-bg);
color: #FFF;
- border-color: var(--primary-color);
+ border-color: var(--radio-button-group-bg);
z-index: 1;
}
diff --git a/src/styles.css b/src/styles.css
index 0f94977..9a104be 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -12,7 +12,10 @@
--button-primary-bg: rgb(175, 58, 190);
--button-alternate-bg: rgba(175, 58, 190, 0.521);
- --button-shadow-color: rgba(64, 29, 68, 0.705);
+ --button-shadow-color: rgba(65, 48, 124, 0.705);
+
+ --radio-button-group-bg: rgb(81, 114, 151);
+ --radio-button-group-hover: rgb(37, 65, 97);
}
/* Light theme */
@@ -26,9 +29,19 @@
--button-primary-bg: #73b6e2c7;
--button-alternate-bg: rgb(176, 216, 240);
- --button-shadow-color: #3d6986;
+ --button-shadow-color: #70a3c5;
+
+ --radio-button-group-bg: rgb(169, 193, 224);
+ --radio-button-group-hover: rgb(221, 227, 241);
}
+/* SVG inversion for light theme using body class */
+body.light-theme img[src$=".svg"] ,
+body.light-theme img[src$=".png"] {
+ filter: invert(0.7);
+}
+
+
/* this was just a star (*) selector, but dark reader extension cannot parse that and crashes
It really just targets text related elements, so just use those instead
*/
@@ -339,7 +352,6 @@ input[type="file"] {
bottom: 10px;
left: 10px;
display: flex;
- opacity: 0.3;
column-gap: 6px;
align-items: center;
transition: opacity 0.5s ease-in-out;