mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix darkmode with color picker
This commit is contained in:
@@ -13,7 +13,12 @@ let DarkMode = null;
|
|||||||
export function updateAllColors(storedSetting, newColor = null) {
|
export function updateAllColors(storedSetting, newColor = null) {
|
||||||
// Determine the color to use
|
// Determine the color to use
|
||||||
const selectedColor = newColor || storedSetting.selectedColor;
|
const selectedColor = newColor || storedSetting.selectedColor;
|
||||||
DarkMode = storedSetting ? storedSetting.DarkMode : DarkMode;
|
|
||||||
|
DarkMode = (typeof storedSetting?.DarkMode === "boolean") ? storedSetting.DarkMode : DarkMode;
|
||||||
|
|
||||||
|
if (typeof storedSetting === "boolean") {
|
||||||
|
DarkMode = storedSetting;
|
||||||
|
}
|
||||||
|
|
||||||
// Common properties, always applied
|
// Common properties, always applied
|
||||||
const commonProps = {
|
const commonProps = {
|
||||||
@@ -24,7 +29,6 @@ export function updateAllColors(storedSetting, newColor = null) {
|
|||||||
|
|
||||||
// Mode-based properties, applied if storedSetting is provided
|
// Mode-based properties, applied if storedSetting is provided
|
||||||
let modeProps = {};
|
let modeProps = {};
|
||||||
console.log("Darkmode: ", DarkMode);
|
|
||||||
if (DarkMode !== null) {
|
if (DarkMode !== null) {
|
||||||
modeProps = DarkMode ? {
|
modeProps = DarkMode ? {
|
||||||
"--background-primary": "#232323",
|
"--background-primary": "#232323",
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
export const openDB = async () => {
|
|
||||||
const request = indexedDB.open("MyDatabase", 1);
|
|
||||||
|
|
||||||
request.onupgradeneeded = async (event) => {
|
|
||||||
const db = event.target.result;
|
|
||||||
await db.createObjectStore("backgrounds", { keyPath: "id" });
|
|
||||||
};
|
|
||||||
|
|
||||||
return request;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const writeData = async (type, data) => {
|
|
||||||
console.log("Reading Data");
|
|
||||||
const db = await openDB();
|
|
||||||
console.log("Opened DB");
|
|
||||||
|
|
||||||
const tx = db.transaction("backgrounds", "readwrite");
|
|
||||||
const store = tx.objectStore("backgrounds");
|
|
||||||
const request = await store.put({ id: "customBackground", type, data });
|
|
||||||
|
|
||||||
console.log("Data written successfully");
|
|
||||||
|
|
||||||
return request.result;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const readData = async () => {
|
|
||||||
const db = await openDB();
|
|
||||||
const tx = db.transaction("backgrounds", "readonly");
|
|
||||||
const store = tx.objectStore("backgrounds");
|
|
||||||
return store.get("customBackground");
|
|
||||||
};
|
|
||||||
@@ -32,6 +32,7 @@ export default class StorageListener {
|
|||||||
|
|
||||||
if (changes.DarkMode) {
|
if (changes.DarkMode) {
|
||||||
this.darkMode = changes.DarkMode.newValue;
|
this.darkMode = changes.DarkMode.newValue;
|
||||||
|
console.log(this.darkMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changes?.customshortcuts?.newValue) {
|
if (changes?.customshortcuts?.newValue) {
|
||||||
|
|||||||
Reference in New Issue
Block a user