chore: Use Nextcloud variables otherwise fallback to default

This commit is contained in:
Rene Hampölz 2023-05-31 12:41:00 +00:00
parent a65415a276
commit cb42124eb2
3 changed files with 416 additions and 450 deletions

View file

@ -1,165 +0,0 @@
/**
* Nextcloud - SnappyMail mail plugin
*
* @author Nextcloud Team
*
* Based on https://github.com/nextcloud/server/blob/master/core/css/variables.scss
*
* Theme variables for Nextcloud backwards compatibility!
*
* When using this theme as a standalone SnappyMail theme,
* this file will serve as a template for customization.
*/
/* Default Nextcloud (v25) theme variables and colors */
:root {
--color-main-background: #ffffff;
--color-main-background-not-plain: #0082c9;
--color-main-background-rgb: 255,255,255;
--color-main-background-translucent: rgba(var(--color-main-background-rgb), .97);
--color-main-background-blur: rgba(var(--color-main-background-rgb), .8);
--filter-background-blur: blur(25px);
--gradient-main-background: var(--color-main-background) 0%, var(--color-main-background-translucent) 85%, transparent 100%;
--color-background-hover: #f5f5f5;
--color-background-dark: #ededed;
--color-background-darker: #dbdbdb;
--color-placeholder-light: #e6e6e6;
--color-placeholder-dark: #cccccc;
--color-main-text: #222222;
--color-text-maxcontrast: #767676;
--color-text-maxcontrast-default: #767676;
--color-text-maxcontrast-background-blur: #646464;
--color-text-light: #222222;
--color-text-lighter: #767676;
--color-scrollbar: rgba(34,34,34, .15);
--color-error: #e9322d;
--color-error-rgb: 233,50,45;
--color-error-hover: #ed5a56;
--color-warning: #eca700;
--color-warning-rgb: 236,167,0;
--color-warning-hover: #efb832;
--color-success: #46ba61;
--color-success-rgb: 70,186,97;
--color-success-hover: #6ac780;
--color-loading-light: #cccccc;
--color-loading-dark: #444444;
--color-box-shadow-rgb: 77,77,77;
--color-box-shadow: rgba(var(--color-box-shadow-rgb), 0.5);
--color-border: #ededed;
--color-border-dark: #dbdbdb;
--font-face: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, Ubuntu, 'Helvetica Neue', Arial, sans-serif, 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
--default-font-size: 15px;
--animation-quick: 100ms;
--animation-slow: 300ms;
--border-radius: 3px;
--border-radius-large: 10px;
--border-radius-pill: 100px;
--default-clickable-area: 44px;
--default-line-height: 24px;
--default-grid-baseline: 4px;
--header-height: 50px;
--navigation-width: 300px;
--sidebar-min-width: 300px;
--sidebar-max-width: 500px;
--list-min-width: 200px;
--list-max-width: 300px;
--header-menu-item-height: 44px;
--header-menu-profile-item-height: 66px;
--breakpoint-mobile: 1024px;
--primary-invert-if-bright: no;
--background-invert-if-dark: no;
--background-invert-if-bright: invert(100%);
--color-primary: #00639a;
--color-primary-default: #0082c9;
--color-primary-text: #ffffff;
--color-primary-hover: #3282ae;
--color-primary-light: #e5eff4;
--color-primary-light-text: #00273d;
--color-primary-light-hover: #dbe4e9;
--color-primary-text-dark: #ededed;
--color-primary-element: #00639a;
--color-primary-element-text: #ffffff;
--color-primary-element-hover: #3282ae;
--color-primary-element-light: #e5eff4;
--color-primary-element-light-text: #00273d;
--color-primary-element-light-hover: #dbe4e9;
--color-primary-element-text-dark: #ededed;
--gradient-primary-background: linear-gradient(40deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
}
@media (prefers-color-scheme: dark) {
:root {
--color-main-background: #171717;
--color-main-background-not-plain: #0082c9;
--color-main-background-rgb: 23,23,23;
--color-main-background-translucent: rgba(var(--color-main-background-rgb), .97);
--color-main-background-blur: rgba(var(--color-main-background-rgb), .8);
--filter-background-blur: blur(25px);
--gradient-main-background: var(--color-main-background) 0%, var(--color-main-background-translucent) 85%, transparent 100%;
--color-background-hover: #212121;
--color-background-dark: #292929;
--color-background-darker: #3b3b3b;
--color-placeholder-light: #313131;
--color-placeholder-dark: #4a4a4a;
--color-main-text: #D8D8D8;
--color-text-maxcontrast: #8c8c8c;
--color-text-maxcontrast-default: #8c8c8c;
--color-text-maxcontrast-background-blur: #919191;
--color-text-light: #bfbfbf;
--color-text-lighter: #a5a5a5;
--color-scrollbar: #3d3d3d;
--color-error: #e9322d;
--color-error-rgb: 233,50,45;
--color-error-hover: #ed5a56;
--color-warning: #eca700;
--color-warning-rgb: 236,167,0;
--color-warning-hover: #efb832;
--color-success: #46ba61;
--color-success-rgb: 70,186,97;
--color-success-hover: #6ac780;
--color-loading-light: #777;
--color-loading-dark: #CCC;
--color-box-shadow-rgb: 0,0,0;
--color-box-shadow: #000000;
--color-border: #292929;
--color-border-dark: #3b3b3b;
--font-face: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, Ubuntu, 'Helvetica Neue', Arial, sans-serif, 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
--default-font-size: 15px;
--animation-quick: 100ms;
--animation-slow: 300ms;
--border-radius: 3px;
--border-radius-large: 10px;
--border-radius-pill: 100px;
--default-clickable-area: 44px;
--default-line-height: 24px;
--default-grid-baseline: 4px;
--header-height: 50px;
--navigation-width: 300px;
--sidebar-min-width: 300px;
--sidebar-max-width: 500px;
--list-min-width: 200px;
--list-max-width: 300px;
--header-menu-item-height: 44px;
--header-menu-profile-item-height: 66px;
--breakpoint-mobile: 1024px;
--primary-invert-if-bright: no;
--background-invert-if-dark: invert(100%);
--background-invert-if-bright: no;
--color-primary: #00639a;
--color-primary-default: #0082c9;
--color-primary-text: #ffffff;
--color-primary-hover: #04537f;
--color-primary-light: #141e24;
--color-primary-light-text: #99c0d6;
--color-primary-light-hover: #1d272d;
--color-primary-text-dark: #ededed;
--color-primary-element: #00639a;
--color-primary-element-text: #ffffff;
--color-primary-element-hover: #04537f;
--color-primary-element-light: #141e24;
--color-primary-element-light-text: #99c0d6;
--color-primary-element-light-hover: #1d272d;
--color-primary-element-text-dark: #ededed;
--gradient-primary-background: linear-gradient(40deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
}
}

View file

@ -10,6 +10,7 @@
document.onreadystatechange = () => {
if (document.readyState === 'complete') {
watchIFrameTitle();
passThemesToIFrame();
let form = document.querySelector('form.snappymail');
form && SnappyMailFormHelper(form);
}
@ -17,7 +18,7 @@ document.onreadystatechange = () => {
// Pass Nextcloud themes and theme attributes to SnappyMail on
// first load and when the SnappyMail iframe is reloaded.
document.addEventListener('DOMContentLoaded', () => {
function passThemesToIFrame() {
const iframe = document.getElementById('rliframe');
if (!iframe) return;
@ -32,7 +33,7 @@ document.addEventListener('DOMContentLoaded', () => {
});
passThemes(iframe);
});
}
// Pass Nextcloud themes and theme attributes to SnappyMail.
function passThemes(iframe) {