Skip to content

Commit bf30973

Browse files
committed
new theme colors solarized and nord
1 parent ed236bb commit bf30973

5 files changed

Lines changed: 104 additions & 4 deletions

File tree

packages/newtab/newtab.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
<select id="theme-selector">
6363
<option value="default">Default</option>
6464
<option value="catppuccin">Catppuccin</option>
65+
<option value="nord">Nord</option>
66+
<option value="solarized">Solarized</option>
6567
</select>
6668

6769
<div class="setting-row">

packages/sidebar/panel.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
<select id="theme-selector">
6363
<option value="default">Default</option>
6464
<option value="catppuccin">Catppuccin</option>
65+
<option value="nord">Nord</option>
66+
<option value="solarized">Solarized</option>
6567
</select>
6668

6769
<div class="setting-row">

shared/colors.js

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,50 @@ const colorManager = {
4444
}
4545
},
4646

47+
// Nord theme - Arctic, north-bluish color palette
48+
nord: {
49+
light: {
50+
name: 'Nord Light',
51+
bg: '#eceff4',
52+
fg: '#4c566a',
53+
accent: '#5e81ac',
54+
border: '#d8dee9',
55+
subtle: '#81a1c1',
56+
shadow: 'rgba(216, 222, 233, 0.5)'
57+
},
58+
dark: {
59+
name: 'Nord Dark',
60+
bg: '#2e3440',
61+
fg: '#d8dee9',
62+
accent: '#88c0d0',
63+
border: '#4c566a',
64+
subtle: '#81a1c1',
65+
shadow: 'rgba(46, 52, 64, 0.5)'
66+
}
67+
},
68+
69+
// Solarized - Precision colors for readability
70+
solarized: {
71+
light: {
72+
name: 'Solarized Light',
73+
bg: '#fdf6e3',
74+
fg: '#657b83',
75+
accent: '#268bd2',
76+
border: '#93a1a1',
77+
subtle: '#586e75',
78+
shadow: 'rgba(147, 161, 161, 0.5)'
79+
},
80+
dark: {
81+
name: 'Solarized Dark',
82+
bg: '#002b36',
83+
fg: '#839496',
84+
accent: '#2aa198',
85+
border: '#073642',
86+
subtle: '#586e75',
87+
shadow: 'rgba(7, 54, 66, 0.5)'
88+
}
89+
},
90+
4791
// Initialize color system
4892
init() {
4993
const savedTheme = localStorage.getItem('notekeeper-theme') || 'default';
@@ -54,7 +98,7 @@ const colorManager = {
5498
applyTheme(themeName) {
5599
let theme;
56100
let isDarkMode = false;
57-
101+
58102
// Handle theme selection
59103
if (themeName === 'default') {
60104
// Use original light/dark toggle behavior
@@ -66,18 +110,36 @@ const colorManager = {
66110
const currentVariant = localStorage.getItem('catppuccin-variant') || 'latte';
67111
theme = this.catppuccin[currentVariant];
68112
isDarkMode = currentVariant === 'frappe';
113+
} else if (themeName === 'nord') {
114+
// Use Nord behavior
115+
const currentVariant = localStorage.getItem('nord-variant') || 'light';
116+
theme = this.nord[currentVariant];
117+
isDarkMode = currentVariant === 'dark';
118+
} else if (themeName === 'solarized') {
119+
// Use Solarized behavior
120+
const currentVariant = localStorage.getItem('solarized-variant') || 'light';
121+
theme = this.solarized[currentVariant];
122+
isDarkMode = currentVariant === 'dark';
69123
} else {
70124
// Direct theme selection
71125
if (themeName.startsWith('catppuccin-')) {
72126
const catppuccinVariant = themeName.replace('catppuccin-', '');
73127
theme = this.catppuccin[catppuccinVariant];
74128
isDarkMode = catppuccinVariant === 'frappe';
129+
} else if (themeName.startsWith('nord-')) {
130+
const nordVariant = themeName.replace('nord-', '');
131+
theme = this.nord[nordVariant];
132+
isDarkMode = nordVariant === 'dark';
133+
} else if (themeName.startsWith('solarized-')) {
134+
const solarizedVariant = themeName.replace('solarized-', '');
135+
theme = this.solarized[solarizedVariant];
136+
isDarkMode = solarizedVariant === 'dark';
75137
} else {
76138
theme = this.defaults[themeName];
77139
isDarkMode = themeName === 'dark';
78140
}
79141
}
80-
142+
81143
if (!theme) return;
82144

83145
// Apply colors to CSS custom properties
@@ -89,10 +151,10 @@ const colorManager = {
89151

90152
// Update theme attribute for existing CSS
91153
document.documentElement.setAttribute('data-theme', isDarkMode ? 'dark' : 'light');
92-
154+
93155
// Save preference
94156
localStorage.setItem('notekeeper-theme', themeName);
95-
157+
96158
// Update theme toggle aria-label
97159
const themeToggle = document.getElementById('theme-toggle');
98160
if (themeToggle) {
@@ -118,6 +180,18 @@ const colorManager = {
118180
const nextVariant = currentVariant === 'latte' ? 'frappe' : 'latte';
119181
localStorage.setItem('catppuccin-variant', nextVariant);
120182
this.applyTheme('catppuccin');
183+
} else if (currentTheme === 'nord') {
184+
// Toggle light/dark in nord mode
185+
const currentVariant = localStorage.getItem('nord-variant') || 'light';
186+
const nextVariant = currentVariant === 'light' ? 'dark' : 'light';
187+
localStorage.setItem('nord-variant', nextVariant);
188+
this.applyTheme('nord');
189+
} else if (currentTheme === 'solarized') {
190+
// Toggle light/dark in solarized mode
191+
const currentVariant = localStorage.getItem('solarized-variant') || 'light';
192+
const nextVariant = currentVariant === 'light' ? 'dark' : 'light';
193+
localStorage.setItem('solarized-variant', nextVariant);
194+
this.applyTheme('solarized');
121195
} else {
122196
// Direct theme selection - toggle between default themes
123197
const nextTheme = currentTheme === 'light' ? 'dark' : 'light';
@@ -135,6 +209,12 @@ const colorManager = {
135209
} else if (currentTheme === 'catppuccin') {
136210
const currentVariant = localStorage.getItem('catppuccin-variant') || 'latte';
137211
return currentVariant === 'latte' ? 'frappe' : 'latte';
212+
} else if (currentTheme === 'nord') {
213+
const currentVariant = localStorage.getItem('nord-variant') || 'light';
214+
return currentVariant === 'light' ? 'dark' : 'light';
215+
} else if (currentTheme === 'solarized') {
216+
const currentVariant = localStorage.getItem('solarized-variant') || 'light';
217+
return currentVariant === 'light' ? 'dark' : 'light';
138218
}
139219
return currentTheme === 'light' ? 'dark' : 'light';
140220
},

shared/preload.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ if (savedTheme === 'default') {
1212
// For catppuccin theme, check the variant storage
1313
const catppuccinVariant = localStorage.getItem("catppuccin-variant") || "latte";
1414
actualTheme = catppuccinVariant === "frappe" ? "dark" : "light";
15+
} else if (savedTheme === 'nord') {
16+
// For nord theme, check the variant storage
17+
const nordVariant = localStorage.getItem("nord-variant") || "light";
18+
actualTheme = nordVariant === "dark" ? "dark" : "light";
19+
} else if (savedTheme === 'solarized') {
20+
// For solarized theme, check the variant storage
21+
const solarizedVariant = localStorage.getItem("solarized-variant") || "light";
22+
actualTheme = solarizedVariant === "dark" ? "dark" : "light";
1523
}
1624

1725
document.documentElement.setAttribute("data-theme", actualTheme || (sysTheme ? "dark" : "light"));

shared/script.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,14 @@ const migrateLegacyTheme = () => {
274274
// Remove old theme key
275275
localStore.remove("theme");
276276
}
277+
278+
// Initialize default variants for new themes if not set
279+
if (!localStorage.getItem('nord-variant')) {
280+
localStorage.setItem('nord-variant', 'light');
281+
}
282+
if (!localStorage.getItem('solarized-variant')) {
283+
localStorage.setItem('solarized-variant', 'light');
284+
}
277285
};
278286

279287
migrateLegacyTheme();

0 commit comments

Comments
 (0)