Skip to content

Build your personal knowledge base with Trilium Notes

feat(theme): use TriliumNext as default theme

Elian Doran2e544a7337ad
diff --git a/src/services/options_init.ts b/src/services/options_init.ts
index 1dc7602d24..ba1789f933 100644
--- a/src/services/options_init.ts
+++ b/src/services/options_init.ts
@@ -38,10 +38,9 @@ interface DefaultOption {
* Initializes the default options for new databases only.
*
* @param initialized `true` if the database has been fully initialized (i.e. a new database was created), or `false` if the database is created for sync.
- * @param theme the theme to set as default, based on a user's system preference.
* @param opts additional options to be initialized, for example the sync configuration.
*/
-async function initNotSyncedOptions(initialized: boolean, theme: string, opts: NotSyncedOpts = {}) {
+async function initNotSyncedOptions(initialized: boolean, opts: NotSyncedOpts = {}) {
optionService.createOption('openNoteContexts', JSON.stringify([
{
notePath: 'root',
@@ -59,7 +58,7 @@ async function initNotSyncedOptions(initialized: boolean, theme: string, opts: N
optionService.createOption('lastSyncedPull', '0', false);
optionService.createOption('lastSyncedPush', '0', false);
- optionService.createOption('theme', theme, false);
+ optionService.createOption('theme', 'next', false);
optionService.createOption('syncServerHost', opts.syncServerHost || '', false);
optionService.createOption('syncServerTimeout', '120000', false);
diff --git a/src/services/sql_init.ts b/src/services/sql_init.ts
index 256971423e..85ddef3343 100644
--- a/src/services/sql_init.ts
+++ b/src/services/sql_init.ts
@@ -57,7 +57,6 @@ async function createInitialDatabase() {
const schema = fs.readFileSync(`${resourceDir.DB_INIT_DIR}/schema.sql`, "utf-8");
const demoFile = fs.readFileSync(`${resourceDir.DB_INIT_DIR}/demo.zip`);
- const defaultTheme = await getDefaultTheme();
let rootNote!: BNote;
@@ -90,7 +89,7 @@ async function createInitialDatabase() {
}).save();
optionsInitService.initDocumentOptions();
- optionsInitService.initNotSyncedOptions(true, defaultTheme, {});
+ optionsInitService.initNotSyncedOptions(true, {});
optionsInitService.initStartupOptions();
password.resetPassword();
});
@@ -128,7 +127,6 @@ async function createDatabaseForSync(options: OptionRow[], syncServerHost = '',
throw new Error("DB is already initialized");
}
- const defaultTheme = await getDefaultTheme();
const schema = fs.readFileSync(`${resourceDir.DB_INIT_DIR}/schema.sql`, "utf8");
// We have to import async since options init requires keyboard actions which require translations.
@@ -137,7 +135,7 @@ async function createDatabaseForSync(options: OptionRow[], syncServerHost = '',
sql.transactional(() => {
sql.executeScript(schema);
- optionsInitService.initNotSyncedOptions(false, defaultTheme, { syncServerHost, syncProxy });
+ optionsInitService.initNotSyncedOptions(false, { syncServerHost, syncProxy });
// document options required for sync to kick off
for (const opt of options) {
@@ -148,16 +146,6 @@ async function createDatabaseForSync(options: OptionRow[], syncServerHost = '',
log.info("Schema and not synced options generated.");
}
-async function getDefaultTheme() {
- if (utils.isElectron()) {
- const {nativeTheme} = await import("electron");
- return nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
- } else {
- // default based on the poll in https://github.com/zadam/trilium/issues/2516
- return "dark";
- }
-}
-
function setDbAsInitialized() {
if (!isDbInitialized()) {
optionService.setOption('initialized', 'true');