Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Theming improvements #4407

Merged
merged 3 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/frontend/packages/core/sass/_all-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
@import '../src/shared/components/tile-selector-tile/tile-selector-tile.component.theme';
@import '../src/shared/components/entity-summary-title/entity-summary-title.component.theme';
@import '../src/shared/components/multiline-title/multiline-title.component.theme';
@import '../src/shared/components/intro-screen/intro-screen.component.theme';
@import '../src/features/user-profile/profile-info/profile-info.component.theme';
@import '../src/core/stateful-icon/stateful-icon.component.theme';
@import './components/mat-snack-bar.theme';
Expand All @@ -65,6 +66,8 @@
@import '../../core/src/features/error-page/error-page/error-page.component.theme';
@import '../../core/src/features/endpoints/backup-restore/restore-endpoints/restore-endpoints.component.theme';
@import '../../core/src/features/metrics/metrics/metrics.component.theme';


// Creates the app theme and applies it to the application
// $theme = Angular Material Theme
// $nav-theme - Colors for the Side Nav (optional)
Expand Down Expand Up @@ -136,4 +139,6 @@
@include app-user-avatar-theme($theme, $app-theme);
@include restore-endpoints-theme($theme, $app-theme);
@include metrics-component-theme($theme, $app-theme);
@include intro-screen-theme($theme, $app-theme);

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Hyperlinks
@mixin app-hyperlinks($theme, $app-theme) {
$primary: map-get($theme, primary);
$link-color: map-get($app-theme, link-color);
$link-active-color: map-get($app-theme, link-active-color);

a {
color: mat-color($primary);
color: $link-color;
&:hover {
color: mat-color($primary, 700);
color: $link-active-color;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

.side-nav {
&__nav-toggle {
color: mat-color($side-nav-colors, text);
color: $side-nav-top-foreground;
}
&__inner {
background-color: mat-color($side-nav-colors, background);
Expand All @@ -28,7 +28,7 @@
}
&__item {
color: mat-color($side-nav-colors, text);
transition: color ease .3s;
transition: none;
&:hover {
background-color: $side-nav-hover-color;
color: mat-color($side-nav-colors, hover-text);
Expand All @@ -40,7 +40,7 @@
}
}
&__items {
color: map-get($app-theme, app-background-text-color);
color: mat-color($side-nav-colors, text);
}
&__logo-text {
color: mat-contrast($primary, 500);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@mixin intro-screen-theme($theme, $app-theme) {
$intro-bg-color: map-get($app-theme, intro-screen-background-color);

@if $intro-bg-color {
// Remove background image from setup screen (e.g. upgrade screen)
app-intro-screen > .intro {
background-color: $intro-bg-color;
background-image: none;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
@mixin app-user-avatar-theme($theme, $app-theme) {
$primary: map-get($theme, primary);
$user-avatar-background-color: map-get($app-theme, user-avatar-background-color);
$user-avatar-foreground-color: map-get($app-theme, user-avatar-foreground-color);
$user-avatar-underflow-invert-colors: map-get($app-theme, user-avatar-underflow-invert-colors);
$user-avatar-header-invert-colors: map-get($app-theme, user-avatar-header-invert-colors);

.user-avatar {
&__initials {
background-color: mat-contrast($primary, 500);
color: mat-color($primary);
background-color: $user-avatar-background-color;
color: $user-avatar-foreground-color;
}
}

@if $user-avatar-underflow-invert-colors {
.user-avatar.user-avatar__large {
.user-avatar__initials {
background-color: $user-avatar-foreground-color;
color: $user-avatar-background-color;
}
}
}

@if $user-avatar-header-invert-colors {
.user-avatar {
.user-avatar__initials.user-avatar__header {
background-color: $user-avatar-foreground-color;
color: $user-avatar-background-color;
}
}
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@mixin app-user-profile-banner-component-theme($theme, $app-theme) {
$primary: map-get($theme, primary);
$foreground: mat-color($primary, default-contrast);

.user-profile-banner {
background-color: mat-color($primary);
background-color: map-get($app-theme, underflow-background-color);
color: map-get($app-theme, underflow-foreground-color);
&__avatar {
color: $foreground;
}
Expand Down
6 changes: 5 additions & 1 deletion src/frontend/packages/devkit/src/lib/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export interface AssetMetadata {
}

// Helpers for getting list of dirs in a dir
const isDirectory = source => fs.lstatSync(source).isDirectory();
const isDirectory = source => {
const realPath = fs.realpathSync(source);
const stats = fs.lstatSync(realPath);
return stats.isDirectory();
}
const getDirectories = source =>
fs.readdirSync(source).map(name => path.join(source, name)).filter(isDirectory);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
@mixin stratos-title-component-theme($theme, $app-theme) {
$primary: map-get($theme, primary);
$show-title-text: map-get($app-theme, stratos-title-show-text);
.stratos-title {
color: mat-color($primary);
@if $show-title-text {
.stratos-title__header {
display: initial;
}
}
}
}
10 changes: 9 additions & 1 deletion src/frontend/packages/theme/_helper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,19 @@ $oss-dark-theme: mat-dark-theme($oss-dark-primary, $oss-dark-accent, $oss-dark-w
ansi-colors: $ansi-color-palette,
header-background-color: mat-color($primary),
header-foreground-color: mat-contrast($primary, 500),
stratos-title-show-text: false,
// Does the header background color span across the top, or is the sidenav background color used for the top-left portion
header-background-span: false,
// Background colors to use for things like the about page header (underflow)
underflow-background-color: mat-color($primary),
underflow-foreground-color: mat-contrast($primary, 500)
underflow-foreground-color: mat-contrast($primary, 500),
link-color: mat-color($primary),
link-active-color: mat-color($primary, 700),
user-avatar-background-color: mat-color($primary),
user-avatar-foreground-color: mat-contrast($primary, 500),
user-avatar-underflow-invert-colors: true,
user-avatar-header-invert-colors: true,
intro-screen-background-color: null
)
);
}
Expand Down