Add CC dark theme option
This commit adds an option to enable a dark theme in the Community
Console. It can be enabled manually with a switch which is injected in
the CC or automatically by syncing it with the OS dark mode setting.
Change-Id: I7506e80a409c5b0190d942c9de88354b6c0cce10
diff --git a/src/content_scripts/console_inject_start.js b/src/content_scripts/console_inject_start.js
index 92ad72b..52482c5 100644
--- a/src/content_scripts/console_inject_start.js
+++ b/src/content_scripts/console_inject_start.js
@@ -10,4 +10,19 @@
document.querySelector('html').setAttribute(
'data-startup', JSON.stringify(startup));
}
+
+ if (items.ccdarktheme) {
+ switch (items.ccdarktheme_mode) {
+ case 'switch':
+ if (items.ccdarktheme_switch_status == true)
+ injectStylesheet(chrome.runtime.getURL('injections/ccdarktheme.css'));
+ break;
+
+ case 'system':
+ injectStylesheet(chrome.runtime.getURL('injections/ccdarktheme.css'), {
+ 'media': '(prefers-color-scheme: dark)',
+ });
+ break;
+ }
+ }
});