Open yann300 opened 3 years ago
Here is a snippet to help in the process (replace colors & fontFamily) :
const remixThemes = [{
url: 'https://res.cloudinary.com/lianahus/raw/upload/v1597918237/remix-themes/PR365/remix-light_powaqg.css',
brightness: 'light',
colors: {
surface: '',
background: '',
foreground: '',
primary: '',
primaryContrast: '',
secondary: '',
secondaryContrast: '',
success: '',
successContrast: '',
warn: '',
warnContrast: '',
error: '',
errorContrast: '',
disabled: '',
},
breakpoints: {
xs: 0,
sm: 600,
md: 1024,
lg: 1440,
xl: 1920
},
fontFamily: '',
space: 8,
}, {
url: 'https://res.cloudinary.com/lianahus/raw/upload/v1597918237/remix-themes/PR365/remix-dark_tvx1s2.css',
brightness: 'dark',
colors: {
surface: '',
background: '',
foreground: '',
primary: '',
primaryContrast: '',
secondary: '',
secondaryContrast: '',
success: '',
successContrast: '',
warn: '',
warnContrast: '',
error: '',
errorContrast: '',
disabled: '',
},
breakpoints: {
xs: 0,
sm: 600,
md: 1024,
lg: 1440,
xl: 1920
},
fontFamily: '',
space: 8,
}];
export class ThemePlugin extends Plugin {
protected theme: Theme = remixThemes['light']
constructor() {
super(themeProfile)
const mode = localStorage.getItem('mode')
this.theme = remixThemes[mode]
}
/** Internal API to set the current theme */
setTheme(mode: 'light' | 'dark') {
this.theme = remixThemes[mode]
this.emit('themeChanged', this.theme)
localStorage.setItem('mode', mode)
}
/** External API to get the current theme */
async currentTheme(): Promise<Theme> {
return this.theme
}
}
the Initial in IDE is currently one from local storage or Dark if none. why you want to set Light as default?
same with quality vs brightness.
The goal is to implement the API from @remixproject/engine-web inside remix-ide.
The plugin should:
currentTheme
&setTheme
themeChanged
event with the new theme insideThemes should used the value of the current themes :