diff --git a/web-angular/m3-theme.scss b/web-angular/m3-theme.scss new file mode 100644 index 00000000..aadef699 --- /dev/null +++ b/web-angular/m3-theme.scss @@ -0,0 +1,152 @@ +// This file was generated by running 'ng generate @angular/material:m3-theme'. +// Proceed with caution if making changes to this file. + +@use 'sass:map'; +@use '@angular/material' as mat; + +// Note: Color palettes are generated from primary: #00695c +$_palettes: ( + primary: ( + 0: #000000, + 10: #00201b, + 20: #003730, + 25: #00443b, + 30: #005046, + 35: #005d52, + 40: #006b5e, + 50: #008676, + 60: #00a38f, + 70: #31bfaa, + 80: #56dbc5, + 90: #76f8e1, + 95: #b5ffef, + 98: #e5fff8, + 99: #f3fffa, + 100: #ffffff, + ), + secondary: ( + 0: #000000, + 10: #06201b, + 20: #1c3530, + 25: #27403b, + 30: #334b46, + 35: #3e5752, + 40: #4a635e, + 50: #637c76, + 60: #7c9690, + 70: #96b1aa, + 80: #b1ccc5, + 90: #cde8e1, + 95: #dbf7ef, + 98: #e5fff8, + 99: #f3fffa, + 100: #ffffff, + ), + tertiary: ( + 0: #000000, + 10: #001e30, + 20: #133348, + 25: #203e54, + 30: #2c4a60, + 35: #38566c, + 40: #446279, + 50: #5d7a92, + 60: #7694ad, + 70: #91afc9, + 80: #accae5, + 90: #cae6ff, + 95: #e6f2ff, + 98: #f6f9ff, + 99: #fcfcff, + 100: #ffffff, + ), + neutral: ( + 0: #000000, + 10: #191c1b, + 20: #2d3130, + 25: #383c3b, + 30: #444746, + 35: #505352, + 40: #5c5f5e, + 50: #747876, + 60: #8e9190, + 70: #a9acaa, + 80: #c4c7c5, + 90: #e0e3e1, + 95: #eff1ef, + 98: #f7faf8, + 99: #fafdfa, + 100: #ffffff, + 4: #0b0f0e, + 6: #101413, + 12: #1d201f, + 17: #272b2a, + 22: #323534, + 24: #363a39, + 87: #d8dbd8, + 92: #e6e9e6, + 94: #eceeec, + 96: #f2f4f2, + ), + neutral-variant: ( + 0: #000000, + 10: #141d1b, + 20: #293230, + 25: #343d3b, + 30: #3f4946, + 35: #4b5452, + 40: #57605e, + 50: #6f7976, + 60: #899390, + 70: #a3adaa, + 80: #bec9c5, + 90: #dae5e1, + 95: #e9f3ef, + 98: #f1fcf8, + 99: #f4fffa, + 100: #ffffff, + ), + error: ( + 0: #000000, + 10: #410002, + 20: #690005, + 25: #7e0007, + 30: #93000a, + 35: #a80710, + 40: #ba1a1a, + 50: #de3730, + 60: #ff5449, + 70: #ff897d, + 80: #ffb4ab, + 90: #ffdad6, + 95: #ffedea, + 98: #fff8f7, + 99: #fffbff, + 100: #ffffff, + ), +); + +$_rest: ( + secondary: map.get($_palettes, secondary), + neutral: map.get($_palettes, neutral), + neutral-variant: map.get($_palettes, neutral-variant), + error: map.get($_palettes, error), +); +$_primary: map.merge(map.get($_palettes, primary), $_rest); +$_tertiary: map.merge(map.get($_palettes, tertiary), $_rest); + +$light-theme: mat.define-theme(( + color: ( + theme-type: light, + primary: $_primary, + + tertiary: $_tertiary, + ), +)); +$dark-theme: mat.define-theme(( + color: ( + theme-type: dark, + primary: $_primary, + tertiary: $_tertiary, + ), +)); \ No newline at end of file diff --git a/web-angular/src/app/layouts/layout_double.component.html b/web-angular/src/app/layouts/layout_double.component.html index d4de008d..823b77a7 100644 --- a/web-angular/src/app/layouts/layout_double.component.html +++ b/web-angular/src/app/layouts/layout_double.component.html @@ -1,6 +1,6 @@
-
+
diff --git a/web-angular/src/app/views-common/reset.component.html b/web-angular/src/app/views-common/reset.component.html index 48157a91..ecaad642 100644 --- a/web-angular/src/app/views-common/reset.component.html +++ b/web-angular/src/app/views-common/reset.component.html @@ -3,7 +3,7 @@ lock {{ res.strings('reset_title') }} - +

{{ res.strings('reset_title') }}

{{ res.strings('reset_subtitle') }}

diff --git a/web-angular/src/app/views-manage/manage-system.component.html b/web-angular/src/app/views-manage/manage-system.component.html index 0fabd83e..032611a5 100644 --- a/web-angular/src/app/views-manage/manage-system.component.html +++ b/web-angular/src/app/views-manage/manage-system.component.html @@ -11,7 +11,7 @@ {{ res.strings('manage_system_title') }} -
+

{{ res.strings('manage_system_equipment_title') }}

{{ res.strings('manage_system_equipment_subtitle') }}

diff --git a/web-angular/src/app/views-user/user-account.component.html b/web-angular/src/app/views-user/user-account.component.html index ec7124e7..c52235b1 100644 --- a/web-angular/src/app/views-user/user-account.component.html +++ b/web-angular/src/app/views-user/user-account.component.html @@ -6,7 +6,7 @@ perm_identity {{ res.strings('user_account_title') }} - + diff --git a/web-angular/src/app/views-weather/city.component.html b/web-angular/src/app/views-weather/city.component.html index e764b1c6..722d4b84 100644 --- a/web-angular/src/app/views-weather/city.component.html +++ b/web-angular/src/app/views-weather/city.component.html @@ -1,7 +1,7 @@
place -
+
@if (city.state) {
{{ city.names | localName }}, @@ -14,7 +14,7 @@
{{ city.names | localName }} - + {{ city.state.names | localName }}, diff --git a/web-angular/src/app/views-weather/city.component.scss b/web-angular/src/app/views-weather/city.component.scss index f9cdbbea..2a581aed 100644 --- a/web-angular/src/app/views-weather/city.component.scss +++ b/web-angular/src/app/views-weather/city.component.scss @@ -79,9 +79,6 @@ .title{ grid-area: title; width: 100%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; } .gmaps{ grid-area: gmaps; diff --git a/web-angular/src/app/views-weather/condition-map.component.html b/web-angular/src/app/views-weather/condition-map.component.html index 5055656f..a4f3688b 100644 --- a/web-angular/src/app/views-weather/condition-map.component.html +++ b/web-angular/src/app/views-weather/condition-map.component.html @@ -8,7 +8,7 @@ [matAutocompleteConnectedTo]="origin" [placeholder]="res.strings('cond_map_search_field_placeholder')"> @if(!autocompIdle){ - + }
- +
diff --git a/web-angular/src/app/views-weather/state.component.html b/web-angular/src/app/views-weather/state.component.html index 4ec4b125..db8a7c2c 100644 --- a/web-angular/src/app/views-weather/state.component.html +++ b/web-angular/src/app/views-weather/state.component.html @@ -12,7 +12,7 @@
- +
diff --git a/web-angular/src/app/views-weather/videos.component.html b/web-angular/src/app/views-weather/videos.component.html index 9639ab1f..b58fbabd 100644 --- a/web-angular/src/app/views-weather/videos.component.html +++ b/web-angular/src/app/views-weather/videos.component.html @@ -11,12 +11,12 @@ @if(video != null){
-

{{ video.source | videoSource }} - {{ video.type | videoType }}

+
{{ video.source | videoSource }} - {{ video.type | videoType }}
}@else{
-

{{ res.strings('videos_no_selection')}}

+
{{ res.strings('videos_no_selection')}}
} diff --git a/web-angular/src/app/widgets-common/map.component.ts b/web-angular/src/app/widgets-common/map.component.ts index ce82fe83..7395fd3e 100644 --- a/web-angular/src/app/widgets-common/map.component.ts +++ b/web-angular/src/app/widgets-common/map.component.ts @@ -5,7 +5,9 @@ import { ElementRef, ViewChild, Input, + ChangeDetectorRef } from '@angular/core'; +import { MediaMatcher } from '@angular/cdk/layout'; import { ResourceService } from '../services/resource.service'; import { Coordinate, Geometry } from '../api'; import * as L from 'leaflet'; @@ -28,7 +30,7 @@ export class MapComponent implements OnInit, DoCheck { static readonly DEFAULT_ZOOM = 13; static readonly MAX_ZOOM = 18; private static readonly DEFAULT_LOCATION = new L.LatLng(51.461663, 7.016645); - private static readonly DEFAULT_TILE_URL = 'https://www.mowesta.com/carta/tile/{z}/{x}/{y}.png'; + private static readonly DEFAULT_TILE_URL = 'https://www.mowesta.com/carta/tile/dark/{z}/{x}/{y}.png'; @ViewChild('map', { read: ElementRef, static: true }) mapElement: ElementRef; @@ -49,13 +51,33 @@ export class MapComponent implements OnInit, DoCheck { private geojson: L.GeoJSON; private attribution: L.Control; private markerElements: MapMarker[] = []; + private tileDark: L.TileLayer; + private tileLight: L.TileLayer; + + private mediaQuery: MediaQueryList; + private mediaQueryListener: () => void; + private resizeObserver?: ResizeObserver; private lastCenter: Coordinate; private lastBounds: Coordinate[]; private lastBoundary: Geometry; private lastMarkers: MapComponentMarker[]; - constructor(public res: ResourceService) { } + constructor(public res: ResourceService, private media: MediaMatcher, private changeDetector: ChangeDetectorRef) { + this.tileLight = this.createTilelayer('https://mobydex.locoslab.com/carta/tile/{z}/{x}/{y}.png'); + this.tileDark = this.createTilelayer('https://mobydex.locoslab.com/carta/tile/dark/{z}/{x}/{y}.png'); + this.mediaQuery = media.matchMedia('(prefers-color-scheme: dark)'); + this.mediaQueryListener = () => { + if (this.mediaQuery.matches) { + this.map.removeLayer(this.tileLight); + this.map.addLayer(this.tileDark); + } else { + this.map.removeLayer(this.tileDark); + this.map.addLayer(this.tileLight); + } + changeDetector.detectChanges(); + } + } ngOnInit() { const object = this; @@ -68,9 +90,7 @@ export class MapComponent implements OnInit, DoCheck { maxZoom: 15, maxBounds: [[-90, -180],[90, 180]] }); - this.layer = new L.TileLayer(MapComponent.DEFAULT_TILE_URL, { - maxZoom: this.maxZoom? this.maxZoom : MapComponent.MAX_ZOOM - }).addTo(this.map); + this.layer = this.tileLight.addTo(this.map); if (this.mapEventHandlers) { this.map.on(this.mapEventHandlers); } if (this.layerEventHandlers) { this.layer.on(this.layerEventHandlers)} @@ -84,6 +104,19 @@ export class MapComponent implements OnInit, DoCheck { this.map.addControl(this.attribution); } + ngAfterViewInit(): void { + if (this.mediaQuery.matches) { + this.map.addLayer(this.tileDark); + } else { + this.map.addLayer(this.tileLight); + } + this.mediaQuery.addEventListener('change', this.mediaQueryListener); + this.resizeObserver = new ResizeObserver(() => { + this.map.invalidateSize(); + }); + this.resizeObserver.observe(this.mapElement.nativeElement); + } + ngDoCheck() { this.map.invalidateSize(); this.updateCenter(); @@ -150,6 +183,14 @@ export class MapComponent implements OnInit, DoCheck { } } } + createTilelayer(url: string): L.TileLayer { + return L.tileLayer(url, { + minZoom: 1, + maxZoom: 19, + attribution: '© OpenStreetMap | © LocosLab GmbH' + }); + } + } /** A marker that shall be added to the map. */ @@ -159,4 +200,4 @@ export interface MapComponentMarker { tooltipOptions?: L.TooltipOptions; iconOptions?: L.IconOptions; clicked?: () => void; -} +} \ No newline at end of file diff --git a/web-angular/src/app/widgets-weather/weather-video-bar.component.html b/web-angular/src/app/widgets-weather/weather-video-bar.component.html index 2fee49d6..1c749392 100644 --- a/web-angular/src/app/widgets-weather/weather-video-bar.component.html +++ b/web-angular/src/app/widgets-weather/weather-video-bar.component.html @@ -12,7 +12,7 @@
-

{{ v.type | videoType }}

+
{{ v.type | videoType }}
} @@ -31,7 +31,7 @@
-

{{ v.type | videoType }}

+
{{ v.type | videoType }}
} @@ -50,7 +50,7 @@
-

{{ v.type | videoType }}

+
{{ v.type | videoType }}
} diff --git a/web-angular/src/styles.scss b/web-angular/src/styles.scss index 72c2e293..f583ac5a 100644 --- a/web-angular/src/styles.scss +++ b/web-angular/src/styles.scss @@ -1,9 +1,11 @@ // Import theming functions @use '@angular/material' as mat; -@import 'theme.scss'; @import 'fonts.scss'; @import 'weather.scss'; @import 'jam.scss'; +@import 'm3-theme.scss'; + +@include mat.core(); // sizes for paddings and margins @@ -24,13 +26,22 @@ $size-side: 500px; } // page reset and font configuration -html { +html { + @include mat.all-component-themes($light-theme); + @include mat.typography-hierarchy($light-theme); height: 100svh; margin: $size-z; padding: $size-z; font-family: Montserrat } +@media (prefers-color-scheme: dark) { + // Only include the colors and not the styles for the dark theme + html { + @include mat.all-component-colors($dark-theme); + } +} + body { height: 100svh; margin: $size-z; @@ -117,11 +128,10 @@ a { .mb-lg { margin-bottom: $size-lg; } /* background colors */ -.bg-default { background-color: $app-background-default; } -.bg-white { background-color: white; } +.bg-default { background-color: mat.get-theme-color($light-theme, neutral, 100);} .bg-lighter { background:rgba(255,255,255,0.1); } -.bg-accent { background-color: mat.m2-get-color-from-palette($app-accent); } -.bg-primary { background-color: mat.m2-get-color-from-palette($app-primary); } +.bg-accent { background-color: mat.get-theme-color($light-theme, tertiary, 98); } +.bg-primary { background-color: mat.get-theme-color($light-theme, primary, 100); } .bg-world { background-image: url('assets/images/world.svg'); background-repeat: no-repeat; @@ -131,12 +141,26 @@ a { background-position-y: 20px; min-height: 350px; } +@media (prefers-color-scheme: dark) { + // Only include the colors and not the styles for the dark theme + .bg-default { background-color: mat.get-theme-color($dark-theme, neutral, 0);} + .bg-lighter { background:rgba(255,255,255,0.1); } //check + .bg-accent { background-color: mat.get-theme-color($dark-theme, tertiary, 10); } //todo change to tertiary + .bg-primary { background-color: mat.get-theme-color($light-theme, primary, 0); } +} /* foreground colors */ .fg-white { color: white; } .fg-gray { color: rgba($color: #000000, $alpha: 0.4) } -.fg-accent { color: mat.m2-get-color-from-palette($app-accent); } -.fg-primary { color: mat.m2-get-color-from-palette($app-primary); } +.fg-accent { color: mat.get-theme-color($light-theme, tertiary, 98); } +.fg-primary { color: mat.get-theme-color($light-theme, primary, 100); } +@media (prefers-color-scheme: dark) { + .fg-white { color: white; } + .fg-gray { color: rgba($color: #000000, $alpha: 0.4) } + .fg-accent { color: mat.get-theme-color($dark-theme, tertiary, 10); } //todo change to teriary + .fg-primary { color: mat.get-theme-color($light-theme, primary, 0); } +} + /* rotation for wind direction icons */ .rotate-45 { transform: rotate(45deg); } @@ -151,23 +175,32 @@ a { /* gradient in column layouts on the right */ .gradient-right { - background-color: mat.m2-get-color-from-palette($app-primary); + background-color: mat.get-theme-color($light-theme, primary, 100); // background-image: radial-gradient(circle at top left, mat-color($app-primary) 10%, mat-color($app-primary-light) 75%, mat-color($app-primary) 100%); align-self: stretch; } +@media (prefers-color-scheme: dark) { + .gradient-right { background-color: mat.get-theme-color($dark-theme, primary, 0);} +} /* gradient in column layouts on the left */ .gradient-left { - background-color: mat.m2-get-color-from-palette($app-primary); + background-color: mat.get-theme-color($light-theme, primary, 100); // background-image: radial-gradient(circle at bottom right, mat-color($app-primary) 10%, mat-color($app-primary-light) 75%, mat-color($app-primary) 100%); align-self: stretch; } +@media (prefers-color-scheme: dark) { + .gradient-left { background-color: mat.get-theme-color($dark-theme, primary, 0);} +} /* sets the cursor to indicate something clickable */ .clickable { cursor: pointer; } -.hov-accent:hover { background-color: mat.m2-get-color-from-palette($app-accent);} +.hov-accent:hover { background-color: mat.get-theme-color($light-theme, tertiary, 98);} +@media (prefers-color-scheme: dark) { + .hov-accent:hover { background-color: mat.get-theme-color($dark-theme, tertiary, 10);} +} - /* cuts of the text, for this to work, you need to set the width */ +/* cuts of the text, for this to work, you need to set the width */ .ellipsis { overflow: hidden; white-space: nowrap; @@ -191,10 +224,15 @@ a { @include mat.elevation(1); z-index: 50; position:relative; - background-color: orange !important; + background-color: mat.get-theme-color($light-theme, secondary, 30) !important; font:500 20px/32px Montserrat !important; min-height: 64px; } +@media (prefers-color-scheme: dark) { + .view-bar{ + background-color: mat.get-theme-color($dark-theme, secondary, 30) !important; + } +} /* the icon in the yellow toolbar */ .view-bar > mat-icon { @@ -215,38 +253,57 @@ a { } .snackbar-accent { - background-color: mat.m2-get-color-from-palette($app-accent); + background-color: mat.get-theme-color($light-theme, tertiary, 98);; color: black; } - -.snackbar-primary { - background-color: mat.m2-get-color-from-palette($app-primary); - color: white; -} -.snackbar-primary > .mat-mdc-simple-snack-bar { - justify-content: space-around; +@media (prefers-color-scheme: dark) { + .snackbar-accent { + background-color: mat.get-theme-color($dark-theme, tertiary, 10);; + color: white; + } } .snackbar-accent > .mat-mdc-simple-snack-bar { justify-content: space-around; } +.snackbar-primary { + background-color: mat.get-theme-color($light-theme, primary, 100); + color: white; +} +@media (prefers-color-scheme: dark) { + .snackbar-primary { + background-color: mat.get-theme-color($dark-theme, primary, 0); + color: black; + } +} + +.snackbar-primary > .mat-mdc-simple-snack-bar { + justify-content: space-around; +} + .video-overlay { - background-color: rgba(mat.m2-get-color-from-palette($app-accent), 0.8); + background-color: rgba(mat.get-theme-color($light-theme, tertiary, 98), 0.8); justify-content: center; padding-top: 10px; padding-bottom: 10px; width: 110px; box-sizing: border-box; border-radius: round(5px); - border: 3px solid rgba(mat.m2-get-color-from-palette($app-primary), 0.8); + border: 3px solid rgba(mat.get-theme-color($light-theme, primary, 100), 0.8); color: black; } +@media (prefers-color-scheme: dark){ + .video-overlay { + background-color: rgba(mat.get-theme-color($dark-theme, tertiary, 10), 0.8); + border: 3px solid rgba(mat.get-theme-color($dark-theme, primary, 0), 0.8); + } +} .video-overlay-scale { border-radius: round(5px); padding: 5px; - background-color: rgba(#ffffff, 0.6); + background-color: rgba(#ffffff, 0.6); //check } .video-overlay-date { @@ -269,7 +326,7 @@ a { } .detail-label { - @extend .mat-caption; + @extend .mat-label-small; //check right size min-width: 90px; } @@ -282,7 +339,7 @@ a { // narrow lists, tables and panels (for visits) .narrow-label { - @extend .mat-caption; + @extend .mat-label-small; //check right size min-width: 40px; } @@ -318,10 +375,15 @@ a { .register-link { - color: mat.m2-get-color-from-palette($app-accent-dark); + color: mat.get-theme-color($dark-theme, tertiary, 10); font-weight: 600; text-decoration: none; } +@media (prefers-color-scheme: dark){ //check + .register-link { + color: mat.get-theme-color($dark-theme, tertiary, 10); + } +} // table stuff .action-cell { @@ -350,8 +412,14 @@ a { /* Forecast Map Styles */ div.forecast-tooltip { font-family: Montserrat; - background-color: #FFFFFF; - border-color: mat.m2-get-color-from-palette($app-primary); + background-color: mat.get-theme-color($light-theme, primary, 100); + border-color: mat.get-theme-color($light-theme, primary, 100); +} +@media (prefers-color-scheme: dark){ + div.forecast-tooltip { + background-color: mat.get-theme-color($dark-theme, primary, 0); + border-color: mat.get-theme-color($dark-theme, primary, 0); + } } div.forecast-tooltip:hover { z-index: 10000; diff --git a/web-angular/src/theme.scss b/web-angular/src/theme.scss deleted file mode 100644 index 7aacca5c..00000000 --- a/web-angular/src/theme.scss +++ /dev/null @@ -1,44 +0,0 @@ -// Custom Theming for Angular Material -// For more information: https://material.angular.io/guide/theming -@use '@angular/material' as mat; -// Plus imports for other components in your app. - -// Include the common styles for Angular Material. We include this here so that you only -// have to load a single css file for Angular Material in your app. -// Be sure that you only ever include this mixin once! -@include mat.core(); - -// Define the palettes for your theme using the Material Design palettes available in palette.scss -// (imported above). For each palette, you can optionally specify a default, lighter, and darker -// hue. Available color palettes: https://material.io/design/color/ - -$app-primary:mat.m2-define-palette(mat.$m2-teal-palette, 800); -$app-accent: mat.m2-define-palette(mat.$m2-yellow-palette, 800); -$app-warn: mat.m2-define-palette(mat.$m2-red-palette); - -// Create the theme object. A theme consists of configurations for individual -// theming systems such as "color" or "typography". -$app-theme: mat.m2-define-light-theme(( - color: ( - primary: $app-primary, - accent: $app-accent, - warn: $app-warn, - ) -)); - -// Include theme styles for core and each component used in your app. -// Alternatively, you can import and @include the theme mixins for each component -// that you are using. -@include mat.all-component-themes($app-theme); - -// Change the fonts - -$app-typography: mat.m2-define-typography-config( - $font-family: 'Montserrat' -); - -@include mat.typography-hierarchy($app-typography); - -$app-accent-dark: mat.m2-define-palette(mat.$m2-red-palette, 800); -$app-background-default: #fafafa; -