Skip to content

Commit

Permalink
allow you to set theme to defualt
Browse files Browse the repository at this point in the history
  • Loading branch information
axellse committed Sep 11, 2024
1 parent 046ff94 commit 04bb6b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion helpers/core/commandProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ export async function processCommand(command) {
case 'theme':
loadThemeObject(command.replace('theme ', ''))
performFullRealTimeReRender()
setPlayStatus('important', 'Applied theme!')
break;
case 'reloadui':
console.clear()
Expand Down
9 changes: 8 additions & 1 deletion ui/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ const __dirname = path.dirname(__filename);
let themeObject = config['storedTheme']

export function loadThemeObject(themeName) {
if (fs.existsSync(path.join(__dirname, 'themes', themeName + '.json'))) {
if (themeName == 'defualt') {
themeObject = null
(async () => { //async for if the drive is slow
editConfigValue('storedTheme', themeObject)
})()
setPlayStatus('important', 'Set theme to defualt!')
} else if (fs.existsSync(path.join(__dirname, 'themes', themeName + '.json'))) {
themeObject = JSON.parse(fs.readFileSync(path.join(__dirname, 'themes', themeName + '.json')));
(async () => { //async for if the drive is slow
editConfigValue('storedTheme', themeObject)
})()
setPlayStatus('important', 'Applied theme!')
} else {
setPlayStatus('important_err', 'Theme file not found.')
}
Expand Down

0 comments on commit 04bb6b6

Please sign in to comment.