Skip to content

Commit

Permalink
WIP - bit of dark theme polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
mvollmer committed Sep 20, 2024
1 parent 1b4651d commit 37c8aaa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
11 changes: 0 additions & 11 deletions pkg/shell/base_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,6 @@ function Frames(index, setupIdleResetTimers) {
self.frame_array[idx] = frame;
else
self.frame_array.push(frame);

const style = localStorage.getItem('shell:style') || 'auto';
let dark_mode;
// If a user set's an explicit theme, ignore system changes.
if ((window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches && style === "auto") || style === "dark") {
dark_mode = true;
} else {
dark_mode = false;
}

frame.dark_mode = dark_mode;
}
return frame;
};
Expand Down
7 changes: 3 additions & 4 deletions pkg/shell/frames.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ export const Frames = ({ state, current_frame }) => {
poll_frame_ready(state, frame, iframe);

// XXX - doesn't work (or is not enough), document has
// zero hight. Make content-area dark?
if (iframe.contentDocument.documentElement) {
// zero height. Make content-area dark?
if (!iframes_by_name[name] && iframe.contentDocument.documentElement) {
const style = localStorage.getItem('shell:style') || 'auto';
if ((window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches
Expand All @@ -210,8 +210,7 @@ export const Frames = ({ state, current_frame }) => {
} else {
iframe.contentDocument.documentElement.style.background = 'white';
}
} else
console.log("No doc?");
}
}
});

Expand Down
3 changes: 3 additions & 0 deletions pkg/shell/shell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ const _ = cockpit.gettext;
/* Don't render into <body>.
*/

/* Move theme state into ShellState, have a setter for it.
*/

function trigger_connection_flow(machine) {
console.log("TRIGGER");
if (window.trigger_connection_flow) {
Expand Down

0 comments on commit 37c8aaa

Please sign in to comment.