Skip to content

Commit 46356f0

Browse files
committed
add light/dark theme to solutions tab
1 parent cbfa789 commit 46356f0

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

src/content-script/common.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
function applyButtonTheme(button, isDarkTheme) {
2-
button.style.backgroundColor = isDarkTheme ? '#333' : '#f9f9f9';
2+
button.style.backgroundColor = isDarkTheme ? '#333' : '#efefef';
33
button.style.color = isDarkTheme ? '#fff' : '#333';
4+
button.onmouseover = () => {
5+
button.style.color = isDarkTheme ? 'orange' : 'green';
6+
};
7+
button.onmouseout = () => {
8+
button.style.color = isDarkTheme ? '#fff' : '#333';
9+
};
410

511
}
612

src/content-script/update-description-tab.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,6 @@ function loadCompanyTags(problemTitle: string, companyTagContainer: HTMLElement)
173173
chrome.storage.local.get(['isDarkTheme'], (result) => {
174174
const isDark = result.isDarkTheme;
175175
applyButtonTheme(button, isDark);
176-
button.onmouseover = () => {
177-
button.style.color = isDark ? 'orange' : 'blue';
178-
};
179-
button.onmouseout = () => {
180-
button.style.color = isDark ? '#fff' : '#333';
181-
};
182-
183176
});
184177

185178
const companyName = document.createTextNode(`${company.name}`);

src/content-script/update-solutions-tab.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,19 @@ function createStyledElement(tagName: string, styles: { [key: string]: string })
1515
function createStyledButton(text: string, isActive: boolean = false): HTMLButtonElement {
1616
const button = document.createElement('button');
1717
button.textContent = text;
18-
button.style.border = '1px solid grey';
19-
button.style.borderColor = isActive ? 'lightgreen' : 'grey';
20-
button.style.backgroundColor = '#222';
18+
button.style.border = '2px solid grey';
2119
button.style.width = '100px';
2220
button.style.padding = '3px';
2321
button.style.margin = '0px 20px';
2422
button.style.borderRadius = '5px';
23+
if (isActive) button.style.borderColor = 'lightgreen';
2524
button.style.fontSize = '12px';
26-
button.addEventListener('mouseover', () => {
27-
button.style.color = 'lightgreen';
28-
});
29-
button.addEventListener('mouseout', () => {
30-
button.style.backgroundColor = '#222';
31-
button.style.color = 'white';
32-
});
25+
chrome.storage.local.get(['isDarkTheme'], (result) => {
26+
const isDark = result.isDarkTheme;
27+
applyButtonTheme(button, isDark);
28+
29+
})
30+
3331
return button;
3432
}
3533

@@ -150,6 +148,7 @@ function hideContent() {
150148
}
151149
}
152150

151+
153152
function createNavContainer(problem: any) {
154153

155154
const navContainer = createStyledElement('div', {

0 commit comments

Comments
 (0)