Skip to content

Commit f6b24c9

Browse files
committed
Mess with themes
1 parent 22d313d commit f6b24c9

File tree

9 files changed

+95
-186
lines changed

9 files changed

+95
-186
lines changed

src/assets/styles/editor.css

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,24 @@ html {
5858
}
5959

6060

61+
.logo {
62+
display: flex;
63+
align-items: center;
64+
gap: var(--space-sm);
65+
}
66+
67+
.logo a {
68+
text-decoration: none;
69+
color: inherit;
70+
}
71+
6172
.editor-toolbar {
6273
display: flex;
6374
align-items: center;
6475
justify-content: space-between;
65-
padding: var(--space-md) var(--space-lg);
76+
padding: var(--space-sm) var(--space-lg);
6677
background: var(--bg-secondary);
67-
height: var(--toolbar-height);
78+
height: var(--header-height);
6879
}
6980

7081
.toolbar-group {
@@ -77,7 +88,8 @@ html {
7788
display: flex;
7889
align-items: center;
7990
gap: var(--space-sm);
80-
padding: var(--space-sm) var(--space-md);
91+
height: 40px;
92+
padding: 0 var(--space-md);
8193
background: var(--bg-tertiary);
8294
border: 1px solid var(--border-primary);
8395
border-radius: var(--radius-md);

src/assets/styles/global_theme.css

Lines changed: 69 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,96 @@
1-
/* CodeTweak App Global Theme */
21
:root {
3-
--primary: #6366f1;
4-
--primary-hover: #4f46e5;
5-
--primary-light: rgba(99, 102, 241, 0.1);
6-
--secondary: #8b5cf6;
7-
--accent: #06b6d4;
8-
9-
--bg-primary: #0a0d1a;
10-
--bg-secondary: #111827;
11-
--bg-tertiary: #1f2937;
12-
--bg-hover: #374151;
13-
14-
--text-primary: #ffffff;
15-
--text-secondary: #d1d5db;
16-
--text-muted: #9ca3af;
17-
--text-accent: #60a5fa;
18-
19-
--border-primary: #374151;
20-
--border-secondary: #4b5563;
21-
--border-accent: #6366f1;
2+
--primary: #61afef;
3+
--primary-hover: #528bff;
4+
--primary-light: rgba(97, 175, 239, 0.15);
5+
--secondary: #c678dd;
6+
--accent: #56b6c2;
7+
8+
--bg-primary: #282c34;
9+
--bg-secondary: #21252b;
10+
--bg-tertiary: #2c313a;
11+
--bg-hover: #3e4451;
12+
13+
--text-primary: #abb2bf;
14+
--text-secondary: #7d8799;
15+
--text-muted: #5c6370;
16+
--text-accent: #61afef;
17+
18+
--border-primary: #3e4451;
19+
--border-secondary: #4b5263;
20+
--border-accent: #61afef;
2221
--border-focus: var(--primary);
23-
24-
--success: #10b981;
25-
--success-light: rgba(16, 185, 129, 0.1);
26-
--warning: #f59e0b;
27-
--warning-light: rgba(245, 158, 11, 0.1);
28-
--error: #ef4444;
29-
--error-light: rgba(239, 68, 68, 0.1);
30-
--info: #3b82f6;
31-
--info-light: rgba(59, 130, 246, 0.1);
32-
33-
--shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
34-
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
35-
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
36-
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
37-
--shadow-glow: 0 0 0 1px rgba(99, 102, 241, 0.05), 0 0 20px rgba(99, 102, 241, 0.1);
38-
--shadow-focus: 0 0 0 3px var(--primary-light);
39-
40-
--shadow-modal: 0 10px 25px rgba(0, 0, 0, 0.3);
22+
23+
--success: #98c379;
24+
--success-light: rgba(152, 195, 121, 0.15);
25+
--warning: #d19a66;
26+
--warning-light: rgba(209, 154, 102, 0.15);
27+
--error: #e06c75;
28+
--error-light: rgba(224, 108, 117, 0.15);
29+
--info: #56b6c2;
30+
--info-light: rgba(86, 182, 194, 0.15);
31+
32+
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
33+
--shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
34+
--shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
35+
--shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.35);
36+
--shadow-glow: 0 0 10px rgba(97, 175, 239, 0.2);
37+
--shadow-focus: 0 0 0 3px rgba(97, 175, 239, 0.25);
38+
39+
--shadow-modal: 0 10px 25px rgba(0, 0, 0, 0.5);
4140
--backdrop-blur: blur(4px);
4241
--modal-z-index: 1000;
43-
44-
--space-xs: 0.25rem; /* 4px */
45-
--space-sm: 0.5rem; /* 8px */
46-
--space-md: 1rem; /* 16px */
47-
--space-lg: 1.5rem; /* 24px */
48-
--space-xl: 2rem; /* 32px */
49-
50-
--radius-sm: 0.25rem; /* 4px */
51-
--radius-md: 0.5rem; /* 8px */
52-
--radius-lg: 0.75rem; /* 12px */
53-
--radius-full: 9999px; /* Fully rounded */
42+
--space-xs: 0.25rem;
43+
--space-sm: 0.5rem;
44+
--space-md: 1rem;
45+
--space-lg: 1.5rem;
46+
--space-xl: 2rem;
47+
48+
--radius-sm: 0.25rem;
49+
--radius-md: 0.5rem;
50+
--radius-lg: 0.75rem;
51+
--radius-full: 9999px;
5452

5553
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
56-
--font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Monaco', 'Consolas', monospace;
57-
58-
--text-xs: 0.75rem; /* 12px */
59-
--text-sm: 0.875rem; /* 14px */
60-
--text-base: 1rem; /* 16px */
61-
--text-lg: 1.125rem; /* 18px */
62-
--text-xl: 1.25rem; /* 20px */
63-
--text-2xl: 1.5rem; /* 24px */
64-
54+
55+
--text-xs: 0.75rem;
56+
--text-sm: 0.875rem;
57+
--text-base: 1rem;
58+
--text-lg: 1.125rem;
59+
--text-xl: 1.25rem;
60+
--text-2xl: 1.5rem;
61+
6562
--font-normal: 400;
6663
--font-medium: 500;
6764
--font-semibold: 600;
68-
65+
6966
--leading-none: 1;
7067
--leading-tight: 1.25;
7168
--leading-snug: 1.375;
7269
--leading-normal: 1.5;
7370
--leading-relaxed: 1.625;
74-
71+
72+
/* === Transitions === */
7573
--transition-fast: 0.1s ease-in-out;
7674
--transition-normal: 0.2s ease-in-out;
7775
--transition-slow: 0.3s ease-in-out;
7876
--transition-slower: 0.5s ease-in-out;
7977
--transition-modal: 0.2s cubic-bezier(0.33, 1, 0.68, 1);
80-
--backdrop-blur: blur(4px);
81-
--modal-z-index: 1000;
82-
78+
8379
--transition-colors: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
8480
--transition-transform: transform var(--transition-fast);
8581
--transition-opacity: opacity var(--transition-fast);
8682
--transition-all: all var(--transition-fast);
87-
83+
84+
/* === Layout === */
8885
--header-height: 60px;
89-
86+
9087
--z-base: 0;
9188
--z-sticky: 20;
9289
--z-fixed: 30;
9390
--z-modal: 50;
9491
--z-toast: 80;
95-
92+
93+
/* === Form Elements === */
9694
--form-element-height: 40px;
9795
--form-element-padding: var(--space-sm) var(--space-md);
9896
--form-element-border: var(--border-primary);
@@ -102,63 +100,13 @@
102100
--button-padding: var(--space-sm) var(--space-lg);
103101
--button-radius: var(--radius-md);
104102
--button-font-weight: var(--font-medium);
105-
103+
106104
--editor-font-size: 14px;
107105
--editor-line-height: 1.5;
108106
--editor-tab-size: 2;
109-
110-
--scrollbar-width: 6px;
111-
--scrollbar-track: transparent;
112-
--scrollbar-thumb: var(--border-secondary);
113-
--scrollbar-thumb-hover: var(--text-muted);
114-
115-
/* Modal styles */
116-
--backdrop-blur: blur(4px);
117-
--modal-z-index: 1000;
118-
}
119-
120-
body.light-theme {
121-
--primary: #4f56e5;
122-
--primary-hover: #4146cf;
123-
--primary-light: rgba(79, 86, 229, 0.12);
124-
--secondary: #7646e0;
125-
--accent: #1491c9;
126-
127-
--bg-primary: #f5f7fb;
128-
--bg-secondary: #eef2f7;
129-
--bg-tertiary: #e6ebf3;
130-
--bg-hover: #e7eefc;
131-
132-
--text-primary: #1f2937;
133-
--text-secondary: #334155;
134-
--text-muted: #64748b;
135-
--text-accent: #2a5cd6;
136-
137-
--border-primary: #dde5ef;
138-
--border-secondary: #c7d2e1;
139-
--border-accent: #4f56e5;
140-
--border-focus: var(--primary);
141-
142-
--success: #059669;
143-
--success-light: rgba(5, 150, 105, 0.08);
144-
--warning: #d97706;
145-
--warning-light: rgba(217, 119, 6, 0.08);
146-
--error: #dc2626;
147-
--error-light: rgba(220, 38, 38, 0.08);
148-
--info: #2563eb;
149-
--info-light: rgba(37, 99, 235, 0.08);
150-
151-
/* Softer elevation for light surfaces */
152-
--shadow-xs: 0 1px 2px 0 rgba(2, 6, 23, 0.02);
153-
--shadow-sm: 0 1px 3px 0 rgba(2, 6, 23, 0.04);
154-
--shadow-md: 0 4px 6px -1px rgba(2, 6, 23, 0.06), 0 2px 4px -1px rgba(2, 6, 23, 0.04);
155-
--shadow-lg: 0 10px 15px -3px rgba(2, 6, 23, 0.05), 0 4px 6px -2px rgba(2, 6, 23, 0.03);
156-
--shadow-glow: 0 0 0 1px rgba(79, 86, 229, 0.05), 0 0 20px rgba(79, 86, 229, 0.08);
157-
--shadow-focus: 0 0 0 3px var(--primary-light);
158-
159-
--shadow-modal: 0 10px 25px rgba(2, 6, 23, 0.10);
160107

108+
--scrollbar-width: 6px;
161109
--scrollbar-track: transparent;
162-
--scrollbar-thumb: var(--border-secondary);
163-
--scrollbar-thumb-hover: var(--text-muted);
164-
}
110+
--scrollbar-thumb: #4b5263;
111+
--scrollbar-thumb-hover: #5c6370;
112+
}

src/dashboard/dashboard-logic.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ async function loadSettings(settingsElements) {
118118
enableAllScripts: true,
119119
showNotifications: true,
120120
confirmBeforeRunning: false,
121-
// follow system theme by default
122-
darkMode: window.matchMedia("(prefers-color-scheme: dark)").matches,
121+
123122
};
124123

125124
// Apply defaults and update storage if needed
@@ -140,8 +139,7 @@ async function loadSettings(settingsElements) {
140139
await chrome.storage.local.set({ settings });
141140
}
142141

143-
// Apply theme based on darkMode setting
144-
applyTheme(settings.darkMode);
142+
145143
} catch (error) {
146144
console.error("Error loading settings:", error);
147145
showNotification("Error loading settings", "error");
@@ -164,7 +162,7 @@ async function saveSettings(settingsElements) {
164162
showNotification("Settings saved successfully", "success");
165163
chrome.runtime.sendMessage({ action: "settingsUpdated" });
166164

167-
applyTheme(settings.darkMode);
165+
168166
} catch (error) {
169167
console.error("Error saving settings:", error);
170168
showNotification("Failed to save settings: " + error.message, "error");
@@ -257,14 +255,7 @@ async function refreshDashboard() {
257255
filterScripts(elements, state);
258256
}
259257

260-
function applyTheme(isDark) {
261-
const body = document.body;
262-
if (isDark) {
263-
body.classList.remove("light-theme");
264-
} else {
265-
body.classList.add("light-theme");
266-
}
267-
}
258+
268259

269260
function exportScript(script) {
270261
try {
@@ -314,6 +305,5 @@ export {
314305
saveSettings,
315306
checkForUpdates,
316307
refreshDashboard,
317-
applyTheme,
318308
exportScript,
319309
};

src/dashboard/dashboard.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ <h2>Browse Greasy Fork Scripts</h2>
165165
<!-- Notifications -->
166166
<div class="notification-container" id="notifications"></div>
167167

168-
<script src="feather.js"></script>
169-
<script>
170-
feather.replace();
171-
</script>
168+
172169
</body>
173170
</html>

src/dashboard/feather.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/editor/editor.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@
1616
<header class="header">
1717
<div class="header-left">
1818
<div class="logo">
19-
<a href="../dashboard/dashboard.html" style="text-decoration: none; color: inherit; display: flex; align-items: center; gap: 8px;">
19+
<a href="../dashboard/dashboard.html">
2020
<span class="home-icon">
2121
<i data-feather="home"></i>
2222
</span>
23-
<div>
24-
<span>CodeTweak</span>
25-
<span>Editor</span>
26-
</div>
2723
</a>
2824
</div>
2925
</div>

src/editor/editor.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ class ScriptEditor {
477477
/**
478478
* Update visibility of script resources section and sidebar icon
479479
*/
480-
toggleResourcesSection(show) {
480+
toggleResourcesSection() {
481481
const resourcesPanel = document.getElementById('resources-panel');
482482
const resourcesIconBtn = document.querySelector('[data-section="resources"]');
483483

@@ -1111,31 +1111,13 @@ document.addEventListener("DOMContentLoaded", async () => {
11111111
// Initialize Feather icons
11121112
feather.replace();
11131113

1114-
// Apply theme and initialize editor
1115-
await applyThemeFromSettings();
1116-
11171114
const editor = new ScriptEditor();
11181115
editor.init().catch((error) => {
11191116
console.error("Failed to initialize script editor:", error);
11201117
});
1121-
1122-
// Listen for runtime theme changes
1123-
chrome.runtime.onMessage.addListener((msg) => {
1124-
if (msg.action === "settingsUpdated") {
1125-
applyThemeFromSettings();
1126-
}
1127-
});
11281118
});
11291119

1130-
async function applyThemeFromSettings() {
1131-
try {
1132-
const { settings = {} } = await chrome.storage.local.get("settings");
1133-
const isDark = settings.darkMode !== false; // default dark mode true
1134-
document.body.classList.toggle("light-theme", !isDark);
1135-
} catch (err) {
1136-
console.error("Error applying theme:", err);
1137-
}
1138-
}
1120+
11391121

11401122
function setupHelpModalTabs() {
11411123
const tabButtons = document.querySelectorAll('.help-tab');

0 commit comments

Comments
 (0)