Skip to content

Commit 36bef5d

Browse files
authored
Merge branch 'master' into rememberfix
2 parents 4865fd7 + d8a10f2 commit 36bef5d

File tree

2 files changed

+6
-52
lines changed

2 files changed

+6
-52
lines changed

apps/remix-ide/src/app/tabs/theme-module.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ export class ThemeModule extends Plugin {
3535
}
3636
this.themes = themes.reduce((acc, theme) => {
3737
theme.url = window.location.origin + window.location.pathname + theme.url
38-
return { ...acc, [theme.name]: theme }
38+
return { ...acc, [theme.name.toLocaleLowerCase()]: theme }
3939
}, {})
4040
this._paq = _paq
4141
let queryTheme = (new QueryParams()).get().theme
42+
queryTheme = queryTheme && queryTheme.toLocaleLowerCase()
4243
queryTheme = this.themes[queryTheme] ? queryTheme : null
4344
let currentTheme = this._deps.config.get('settings/theme')
45+
currentTheme = currentTheme && currentTheme.toLocaleLowerCase()
4446
currentTheme = this.themes[currentTheme] ? currentTheme : null
4547
this.currentThemeState = { queryTheme, currentTheme }
46-
this.active = queryTheme || currentTheme || 'Dark'
48+
this.active = queryTheme || currentTheme || 'dark'
4749
this.forced = !!queryTheme
4850
}
4951

@@ -82,6 +84,7 @@ export class ThemeModule extends Plugin {
8284
* @param {string} [themeName] - The name of the theme
8385
*/
8486
switchTheme (themeName) {
87+
themeName = themeName && themeName.toLocaleLowerCase()
8588
if (themeName && !Object.keys(this.themes).includes(themeName)) {
8689
throw new Error(`Theme ${themeName} doesn't exist`)
8790
}

libs/remix-ui/theme-module/src/lib/remix-ui-theme-module.tsx

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,55 +8,6 @@ export interface RemixUiThemeModuleProps {
88
themeModule: ThemeModule;
99
}
1010

11-
const defaultThemes = [
12-
{
13-
name: 'Dark',
14-
quality: 'dark',
15-
url: 'assets/css/themes/remix-dark_tvx1s2.css'
16-
},
17-
{
18-
name: 'Light',
19-
quality: 'light',
20-
url: 'assets/css/themes/remix-light_powaqg.css'
21-
},
22-
{
23-
name: 'Midcentury',
24-
quality: 'light',
25-
url: 'assets/css/themes/remix-midcentury_hrzph3.css'
26-
},
27-
{
28-
name: 'Black',
29-
quality: 'dark',
30-
url: 'assets/css/themes/remix-black_undtds.css'
31-
},
32-
{
33-
name: 'Candy',
34-
quality: 'light',
35-
url: 'assets/css/themes/remix-candy_ikhg4m.css'
36-
},
37-
38-
{
39-
name: 'Cerulean',
40-
quality: 'light',
41-
url: 'assets/css/themes/bootstrap-cerulean.min.css'
42-
},
43-
{
44-
name: 'Flatly',
45-
quality: 'light',
46-
url: 'assets/css/themes/bootstrap-flatly.min.css'
47-
},
48-
{
49-
name: 'Spacelab',
50-
quality: 'light',
51-
url: 'assets/css/themes/bootstrap-spacelab.min.css'
52-
},
53-
{
54-
name: 'Cyborg',
55-
quality: 'dark',
56-
url: 'assets/css/themes/bootstrap-cyborg.min.css'
57-
}
58-
];
59-
6011
export function RemixUiThemeModule({ themeModule }: RemixUiThemeModuleProps) {
6112
const [themeName, setThemeName] = useState('')
6213

@@ -85,7 +36,7 @@ export function RemixUiThemeModule({ themeModule }: RemixUiThemeModuleProps) {
8536
name="theme"
8637
id={theme.name}
8738
data-id={`settingsTabTheme${theme.name}`}
88-
checked={themeModule.active === theme.name}
39+
checked={themeModule.active === theme.name.toLocaleLowerCase()}
8940
/>
9041
<label
9142
className="form-check-label custom-control-label"

0 commit comments

Comments
 (0)