Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: at function is not defined on macos, resulting in theme not working on macos #208

Merged
merged 2 commits into from
Dec 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/Components/Theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ const changeTheme = async (theme?: string, category?: '*' | 'root' | 'tabbing' |
if (!category) category = '*';
const appearance = await Storage.get('appearance');
if (category === '*' || category === 'root') {
1;
document.body.style.setProperty('--edge-radius', appearance?.frameStyle === 'os' ? '0px' : '10px');
document.body.style.fontSize = appearance?.fontSize ?? '16px';
document.documentElement.style.fontSize = appearance?.fontSize ?? '16px';
Expand Down Expand Up @@ -131,12 +130,12 @@ const changeTheme = async (theme?: string, category?: '*' | 'root' | 'tabbing' |
const style = document.querySelector('style#root') ?? document.createElement('style');
style.id = 'root';
let styles = '';

// Generate CSS styles from user theme
for (const key of Object.keys(themeJSON ?? defaultThemeJSON[theme])) {
const value = themeJSON ? themeJSON[key] : defaultThemeJSON[theme]?.[key];
const formalKey = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());
const styleKey = formalKey.split('.').at(-1);
const splittedKey = formalKey.split('.')
const styleKey =splittedKey[splittedKey.length - 1];
if (key.startsWith('hljs')) {
const className = formalKey.split('.').slice(0, -1).join('.').replace('hljs.', 'hljs-');
styles += `.${className} { ${styleKey}: ${value}; }\n`;
Expand Down