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

Toggle dark mode #11

Merged
merged 7 commits into from
Dec 17, 2024
Merged

Toggle dark mode #11

merged 7 commits into from
Dec 17, 2024

Conversation

roth-dev
Copy link
Collaborator

No description provided.

@roth-dev
Copy link
Collaborator Author

roth-dev commented Dec 15, 2024

Should be close: #10

@invisal
Copy link
Collaborator

invisal commented Dec 16, 2024

We need to set the dark mode here as well:

https://github.com/outerbase/studio-desktop/blob/master/electron/main.ts#L77

  const queryString = new URLSearchParams({ name: conn.name, theme: "dark" | "light" }).toString();

I believe you cannot use localStorage to do it. You need to write it to file.

You can check https://github.com/outerbase/studio-desktop/blob/master/electron/file-helper.ts#L5 on how to deal with which path to write. Try to write to setting.json.

Create setting class

const setting = new Setting();
setting.load();  // load the setting from file. If no file, make it
setting.get("theme") // get theme value
setting.set("theme", "dark"); // set dark mode and write to file

Then, you can use ipc to set it from renderer window.

@roth-dev
Copy link
Collaborator Author

We need to set the dark mode here as well:

https://github.com/outerbase/studio-desktop/blob/master/electron/main.ts#L77

  const queryString = new URLSearchParams({ name: conn.name, theme: "dark" | "light" }).toString();

I believe you cannot use localStorage to do it. You need to write it to file.

You can check https://github.com/outerbase/studio-desktop/blob/master/electron/file-helper.ts#L5 on how to deal with which path to write. Try to write to setting.json.

Create setting class

const setting = new Setting();
setting.load();  // load the setting from file. If no file, make it
setting.get("theme") // get theme value
setting.set("theme", "dark"); // set dark mode and write to file

Then, you can use ipc to set it from renderer window.

Let me change it.

@roth-dev
Copy link
Collaborator Author

All updated according to suggestion.

@invisal invisal merged commit fa9f8e9 into outerbase:master Dec 17, 2024
@roth-dev roth-dev mentioned this pull request Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants