Skip to content

Commit d08e0d3

Browse files
committed
webmail: fix dark mode
broken in v0.0.14, probably when introducing the css variables. i had noticed this issue at the time, and thought i fixed it, but clearly not. for issue #278, reported by gdunstone
1 parent 091faa8 commit d08e0d3

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

webmail/lib.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
// Makes it easier to look through a DOM, and easier to change the style of all
88
// instances of a class.
99

10-
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
11-
const cssStyle = dom.style(attr.type('text/css'))
12-
document.head.prepend(cssStyle)
13-
const styleSheet = cssStyle.sheet!
14-
1510
const cssStyleDark = dom.style(attr.type('text/css'))
1611
document.head.prepend(cssStyleDark)
1712
const styleSheetDark = cssStyleDark.sheet!
1813
styleSheetDark.insertRule('@media (prefers-color-scheme: dark) {}')
1914
const darkModeRule = styleSheetDark.cssRules[0] as CSSMediaRule
2015

16+
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
17+
const cssStyle = dom.style(attr.type('text/css'))
18+
document.head.prepend(cssStyle)
19+
const styleSheet = cssStyle.sheet!
20+
2121
let cssRules: { [selector: string]: string} = {} // For ensuring a selector has a single definition.
2222
// Ensure a selector has the given style properties. If a style value is an array,
2323
// it must have 2 elements. The first is the default value, the second used for a

webmail/msg.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,15 +1062,15 @@ var api;
10621062
// - To use class names for styling, instead of the the many inline styles.
10631063
// Makes it easier to look through a DOM, and easier to change the style of all
10641064
// instances of a class.
1065-
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
1066-
const cssStyle = dom.style(attr.type('text/css'));
1067-
document.head.prepend(cssStyle);
1068-
const styleSheet = cssStyle.sheet;
10691065
const cssStyleDark = dom.style(attr.type('text/css'));
10701066
document.head.prepend(cssStyleDark);
10711067
const styleSheetDark = cssStyleDark.sheet;
10721068
styleSheetDark.insertRule('@media (prefers-color-scheme: dark) {}');
10731069
const darkModeRule = styleSheetDark.cssRules[0];
1070+
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
1071+
const cssStyle = dom.style(attr.type('text/css'));
1072+
document.head.prepend(cssStyle);
1073+
const styleSheet = cssStyle.sheet;
10741074
let cssRules = {}; // For ensuring a selector has a single definition.
10751075
// Ensure a selector has the given style properties. If a style value is an array,
10761076
// it must have 2 elements. The first is the default value, the second used for a

webmail/text.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,15 +1062,15 @@ var api;
10621062
// - To use class names for styling, instead of the the many inline styles.
10631063
// Makes it easier to look through a DOM, and easier to change the style of all
10641064
// instances of a class.
1065-
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
1066-
const cssStyle = dom.style(attr.type('text/css'));
1067-
document.head.prepend(cssStyle);
1068-
const styleSheet = cssStyle.sheet;
10691065
const cssStyleDark = dom.style(attr.type('text/css'));
10701066
document.head.prepend(cssStyleDark);
10711067
const styleSheetDark = cssStyleDark.sheet;
10721068
styleSheetDark.insertRule('@media (prefers-color-scheme: dark) {}');
10731069
const darkModeRule = styleSheetDark.cssRules[0];
1070+
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
1071+
const cssStyle = dom.style(attr.type('text/css'));
1072+
document.head.prepend(cssStyle);
1073+
const styleSheet = cssStyle.sheet;
10741074
let cssRules = {}; // For ensuring a selector has a single definition.
10751075
// Ensure a selector has the given style properties. If a style value is an array,
10761076
// it must have 2 elements. The first is the default value, the second used for a

webmail/webmail.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,15 +1062,15 @@ var api;
10621062
// - To use class names for styling, instead of the the many inline styles.
10631063
// Makes it easier to look through a DOM, and easier to change the style of all
10641064
// instances of a class.
1065-
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
1066-
const cssStyle = dom.style(attr.type('text/css'));
1067-
document.head.prepend(cssStyle);
1068-
const styleSheet = cssStyle.sheet;
10691065
const cssStyleDark = dom.style(attr.type('text/css'));
10701066
document.head.prepend(cssStyleDark);
10711067
const styleSheetDark = cssStyleDark.sheet;
10721068
styleSheetDark.insertRule('@media (prefers-color-scheme: dark) {}');
10731069
const darkModeRule = styleSheetDark.cssRules[0];
1070+
// We keep the default/regular styles and dark-mode styles in separate stylesheets.
1071+
const cssStyle = dom.style(attr.type('text/css'));
1072+
document.head.prepend(cssStyle);
1073+
const styleSheet = cssStyle.sheet;
10741074
let cssRules = {}; // For ensuring a selector has a single definition.
10751075
// Ensure a selector has the given style properties. If a style value is an array,
10761076
// it must have 2 elements. The first is the default value, the second used for a

0 commit comments

Comments
 (0)