diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 96f37fdcf..e7ca7e28f 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -8,6 +8,7 @@ import { ChannelStore } from './state'; import { StorageMap } from '@ngx-pwa/local-storage'; import { Settings } from './settings/settings.interface'; import { EPG_ERROR, EPG_FETCH, EPG_FETCH_DONE } from '../../ipc-commands'; +import { SettingsService } from './services/settings.service'; // create custom title bar new Titlebar({ @@ -28,6 +29,7 @@ export class AppComponent { private ngZone: NgZone, private router: Router, private translate: TranslateService, + private settingsService: SettingsService, private snackBar: MatSnackBar, private storage: StorageMap ) { @@ -115,6 +117,10 @@ export class AppComponent { horizontalPosition: 'right', }); } + + if (settings.theme) { + this.settingsService.changeTheme(settings.theme); + } } }); diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss index be72b2070..f7719d9a8 100644 --- a/src/app/home/home.component.scss +++ b/src/app/home/home.component.scss @@ -3,11 +3,7 @@ text-transform: uppercase; } - .mat-tab-group.mat-background-primary .mat-tab-header { - background: #000 !important; - } - .mat-tab-group.mat-background-primary .mat-tab-header-pagination { - display:none; + display: none; } -} \ No newline at end of file +} diff --git a/src/app/home/recent-playlists/playlist-info/playlist-info.component.html b/src/app/home/recent-playlists/playlist-info/playlist-info.component.html index e777ffc7e..67cb6686d 100644 --- a/src/app/home/recent-playlists/playlist-info/playlist-info.component.html +++ b/src/app/home/recent-playlists/playlist-info/playlist-info.component.html @@ -28,7 +28,7 @@ - + {{ 'HOME.PLAYLISTS.INFO_DIALOG.CLOSE' | translate }} diff --git a/src/app/home/recent-playlists/recent-playlists.component.html b/src/app/home/recent-playlists/recent-playlists.component.html index 0965db4bd..35a459f15 100644 --- a/src/app/home/recent-playlists/recent-playlists.component.html +++ b/src/app/home/recent-playlists/recent-playlists.component.html @@ -35,7 +35,7 @@ @@ -43,7 +43,7 @@ diff --git a/src/app/player/components/channel-list-container/channel-list-container.component.scss b/src/app/player/components/channel-list-container/channel-list-container.component.scss index 670f258e5..79bcfa29e 100644 --- a/src/app/player/components/channel-list-container/channel-list-container.component.scss +++ b/src/app/player/components/channel-list-container/channel-list-container.component.scss @@ -16,6 +16,20 @@ .search-bar { padding: 8px; + background: #ddd; + border: none; + border-radius: 4px; +} + +::ng-deep .dark-theme { + .search-bar { + background: #666; + color: #fff; + } + + .search-bar::placeholder { + color: #ccc; + } } ::ng-deep { @@ -26,9 +40,10 @@ border-radius: 0 !important; } - .mat-tab-label, .mat-tab-label-active { - min-width: 0!important; - padding: 15px!important; - margin: 5px!important; + .mat-tab-label, + .mat-tab-label-active { + min-width: 0 !important; + padding: 15px !important; + margin: 5px !important; } -} \ No newline at end of file +} diff --git a/src/app/player/components/epg-list/epg-list.component.html b/src/app/player/components/epg-list/epg-list.component.html index c3ad43b9e..6423ecf66 100644 --- a/src/app/player/components/epg-list/epg-list.component.html +++ b/src/app/player/components/epg-list/epg-list.component.html @@ -1,6 +1,6 @@ - + + + + + + {{ 'SETTINGS.THEME' | translate }} + + + {{ + 'SETTINGS.VIDEO_PLAYER_PLACEHOLDER' + | translate + }} + + {{ + 'THEMES.' + theme.value | translate + }} + + + + + {{ 'SETTINGS.VERSION' | translate }} @@ -109,7 +133,7 @@ @@ -119,7 +143,7 @@ diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index 0083b971a..508f46080 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -12,6 +12,8 @@ import { ElectronService } from '../services/electron.service'; import { ChannelQuery } from '../state'; import { EPG_FETCH } from '../../../ipc-commands'; import { Language } from './language.enum'; +import { Theme } from './theme.enum'; +import { SettingsService } from './../services/settings.service'; /** Url of the package.json file in the app repository, required to get the version of the released app */ const PACKAGE_JSON_URL = @@ -55,6 +57,9 @@ export class SettingsComponent implements OnInit, OnDestroy { (store) => store.epgAvailable ); + /** All available visual themes */ + themeEnum = Theme; + /** * Creates an instance of SettingsComponent and injects some dependencies into the component * @param channelQuery @@ -62,8 +67,10 @@ export class SettingsComponent implements OnInit, OnDestroy { * @param formBuilder * @param http * @param router + * @param settingsService * @param snackBar * @param storage + * @param translate */ constructor( private channelQuery: ChannelQuery, @@ -71,6 +78,7 @@ export class SettingsComponent implements OnInit, OnDestroy { private formBuilder: FormBuilder, private http: HttpClient, private router: Router, + private settingsService: SettingsService, private snackBar: MatSnackBar, private storage: StorageMap, private translate: TranslateService @@ -79,6 +87,7 @@ export class SettingsComponent implements OnInit, OnDestroy { player: ['videojs'], epgUrl: '', language: Language.ENGLISH, + theme: Theme.LightTheme, }); this.subscription.add( @@ -119,6 +128,9 @@ export class SettingsComponent implements OnInit, OnDestroy { language: settings.language ? settings.language : Language.ENGLISH, + theme: settings.theme + ? settings.theme + : Theme.LightTheme, }); } }) @@ -139,6 +151,9 @@ export class SettingsComponent implements OnInit, OnDestroy { this.fetchEpg(); } this.translate.use(this.settingsForm.value.language); + this.settingsService.changeTheme( + this.settingsForm.value.theme + ); this.snackBar.open( this.translate.instant('SETTINGS.SETTINGS_SAVED'), null, diff --git a/src/app/settings/settings.interface.ts b/src/app/settings/settings.interface.ts index f67818c5c..5a3aa03df 100644 --- a/src/app/settings/settings.interface.ts +++ b/src/app/settings/settings.interface.ts @@ -1,4 +1,5 @@ import { Language } from './language.enum'; +import { Theme } from './theme.enum'; export type VideoPlayerType = 'html5' | 'videojs'; @@ -9,4 +10,5 @@ export interface Settings { player: VideoPlayerType; epgUrl: string; language: Language; + theme: Theme; } diff --git a/src/app/settings/theme.enum.ts b/src/app/settings/theme.enum.ts new file mode 100644 index 000000000..807c22f22 --- /dev/null +++ b/src/app/settings/theme.enum.ts @@ -0,0 +1,4 @@ +export enum Theme { + DarkTheme = 'DARK_THEME', + LightTheme = 'LIGHT_THEME', +} diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 1d42fb397..2bdd88bfd 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -87,7 +87,12 @@ "VERSION": "Version", "VIDEO_PLAYER_LABEL": "Video player", "VIDEO_PLAYER_PLACEHOLDER": "Option auswählen", - "SETTINGS_SAVED": "Einstellungen wurden erfolgreich gespeichert!" + "SETTINGS_SAVED": "Einstellungen wurden erfolgreich gespeichert!", + "THEME": "Farbdesign" + }, + "THEMES": { + "DARK_THEME": "Dunkel", + "LIGHT_THEME": "Hell" }, "TOP_MENU": { "OPEN_CHANNELS_LIST": "Senderliste öffnen", diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index e23f9a739..ea988dc04 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -50,7 +50,12 @@ "NEW_VERSION_AVAILABLE": "There is a new version available", "LATEST_VERSION": "You are using the latest version", "LANGUAGE": "Language", - "SETTINGS_SAVED": "Success! Configuration was saved." + "SETTINGS_SAVED": "Success! Configuration was saved.", + "THEME": "Visual theme" + }, + "THEMES": { + "DARK_THEME": "Dark theme", + "LIGHT_THEME": "Light theme" }, "CHANNELS": { "SEARCH_CHANNEL": "Search channel", diff --git a/src/assets/i18n/ru.json b/src/assets/i18n/ru.json index 02836e607..3e42d60fb 100644 --- a/src/assets/i18n/ru.json +++ b/src/assets/i18n/ru.json @@ -50,7 +50,12 @@ "NEW_VERSION_AVAILABLE": "Доступна новая версия приложения", "LATEST_VERSION": "Вы используете последнюю версию приложения", "LANGUAGE": "Язык", - "SETTINGS_SAVED": "Новые настройки были успешно сохранены." + "SETTINGS_SAVED": "Новые настройки были успешно сохранены.", + "THEME": "Тема оформления" + }, + "THEMES": { + "DARK_THEME": "Тёмная тема", + "LIGHT_THEME": "Светлая тема" }, "CHANNELS": { "SEARCH_CHANNEL": "Поиск каналов", diff --git a/src/index.html b/src/index.html index 26beb79fb..688a48a20 100644 --- a/src/index.html +++ b/src/index.html @@ -1,14 +1,14 @@ - + - - - IPTVnator - + + + IPTVnator + - - - - - - + + + + + + diff --git a/src/styles.scss b/src/styles.scss index 94c6c992d..52d6a6d85 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1,14 +1,16 @@ +$material-icons-font-path: '~material-icons/iconfont/'; /* You can add global styles to this file, and also import other style files */ @import '~@angular/material/prebuilt-themes/indigo-pink.css'; - -$material-icons-font-path: '~material-icons/iconfont/'; - @import '~material-icons/iconfont/material-icons.scss'; +@import "~@angular/material/theming"; +@include mat-core(); +@import 'themes/'; body, html { background: #fff; font-family: caption; + user-select: none; } .mat-toolbar.mat-primary { @@ -70,13 +72,13 @@ html, body { height: 54px; } -:not(input):not(textarea), +/* :not(input):not(textarea), :not(input):not(textarea)::after, :not(input):not(textarea)::before { -webkit-user-select: none; user-select: none; cursor: default; -} +} */ input, button, textarea, :focus { outline: none; } \ No newline at end of file diff --git a/src/themes/_index.scss b/src/themes/_index.scss new file mode 100644 index 000000000..cecb1f848 --- /dev/null +++ b/src/themes/_index.scss @@ -0,0 +1,48 @@ +$black: ( + 50: #000000, + 100: #000000, + 200: #000000, + 300: #000000, + 400: #000000, + 500: #000000, + 600: #000000, + 700: #000000, + 800: #000000, + 900: #000000, + A100: #000000, + A200: #000000, + A400: #000000, + A700: #000000, + contrast: ( + 50: $light-primary-text, + 100: $light-primary-text, + 200: $light-primary-text, + 300: $light-primary-text, + 400: $light-primary-text, + 500: $light-primary-text, + 600: $light-primary-text, + 700: $light-primary-text, + 800: $light-primary-text, + 900: $light-primary-text, + A100: $light-primary-text, + A200: $light-primary-text, + A400: $light-primary-text, + A700: $light-primary-text, + ), +); + +$angular-primary: mat-palette($black); +$angular-accent: mat-palette($mat-indigo, 500, 600, 700); +$angular-warn: mat-palette($mat-red); +$angular-default-theme: mat-light-theme( + ( + color: ( + primary: $angular-primary, + accent: $angular-accent, + warn: $angular-warn, + ), + ) +); +@include angular-material-theme($angular-default-theme); + +@import 'dark'; diff --git a/src/themes/dark.scss b/src/themes/dark.scss new file mode 100644 index 000000000..ac18ffcf7 --- /dev/null +++ b/src/themes/dark.scss @@ -0,0 +1,16 @@ +$dark-primary: mat-palette($black, A200, A800, A500); +$dark-accent: mat-palette($mat-teal, A400, A100, A400); +$dark-warn: mat-palette($mat-red); +$dark-theme: mat-dark-theme( + ( + color: ( + primary: $dark-primary, + accent: $dark-accent, + warn: $dark-warn, + ), + ) +); + +.dark-theme { + @include angular-material-color($dark-theme); +}
{{ 'SETTINGS.THEME' | translate }}
+ + {{ + 'SETTINGS.VIDEO_PLAYER_PLACEHOLDER' + | translate + }} + + {{ + 'THEMES.' + theme.value | translate + }} + + +
{{ 'SETTINGS.VERSION' | translate }}