Merge pull request #1923 from 4Science/CST-6171

Customizability of theme colours
This commit is contained in:
Tim Donohue
2023-01-05 15:00:41 -06:00
committed by GitHub
7 changed files with 50 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
nav.navbar { nav.navbar {
border-bottom: 1px var(--bs-gray-400) solid; border-bottom: 1px var(--ds-header-navbar-border-bottom-color) solid;
align-items: baseline; align-items: baseline;
} }

View File

@@ -55,34 +55,34 @@ describe('MyDSpaceItemStatusComponent', () => {
component.status = MyDspaceItemStatusType.VALIDATION; component.status = MyDspaceItemStatusType.VALIDATION;
fixture.detectChanges(); fixture.detectChanges();
expect(component.badgeContent).toBe(MyDspaceItemStatusType.VALIDATION); expect(component.badgeContent).toBe(MyDspaceItemStatusType.VALIDATION);
expect(component.badgeClass).toBe('text-light badge badge-warning'); expect(component.badgeClass).toBe('text-light badge badge-validation');
}); });
it('should init badge content and class', () => { it('should init badge content and class', () => {
component.status = MyDspaceItemStatusType.WAITING_CONTROLLER; component.status = MyDspaceItemStatusType.WAITING_CONTROLLER;
fixture.detectChanges(); fixture.detectChanges();
expect(component.badgeContent).toBe(MyDspaceItemStatusType.WAITING_CONTROLLER); expect(component.badgeContent).toBe(MyDspaceItemStatusType.WAITING_CONTROLLER);
expect(component.badgeClass).toBe('text-light badge badge-info'); expect(component.badgeClass).toBe('text-light badge badge-waiting-controller');
}); });
it('should init badge content and class', () => { it('should init badge content and class', () => {
component.status = MyDspaceItemStatusType.WORKSPACE; component.status = MyDspaceItemStatusType.WORKSPACE;
fixture.detectChanges(); fixture.detectChanges();
expect(component.badgeContent).toBe(MyDspaceItemStatusType.WORKSPACE); expect(component.badgeContent).toBe(MyDspaceItemStatusType.WORKSPACE);
expect(component.badgeClass).toBe('text-light badge badge-primary'); expect(component.badgeClass).toBe('text-light badge badge-workspace');
}); });
it('should init badge content and class', () => { it('should init badge content and class', () => {
component.status = MyDspaceItemStatusType.ARCHIVED; component.status = MyDspaceItemStatusType.ARCHIVED;
fixture.detectChanges(); fixture.detectChanges();
expect(component.badgeContent).toBe(MyDspaceItemStatusType.ARCHIVED); expect(component.badgeContent).toBe(MyDspaceItemStatusType.ARCHIVED);
expect(component.badgeClass).toBe('text-light badge badge-success'); expect(component.badgeClass).toBe('text-light badge badge-archived');
}); });
it('should init badge content and class', () => { it('should init badge content and class', () => {
component.status = MyDspaceItemStatusType.WORKFLOW; component.status = MyDspaceItemStatusType.WORKFLOW;
fixture.detectChanges(); fixture.detectChanges();
expect(component.badgeContent).toBe(MyDspaceItemStatusType.WORKFLOW); expect(component.badgeContent).toBe(MyDspaceItemStatusType.WORKFLOW);
expect(component.badgeClass).toBe('text-light badge badge-info'); expect(component.badgeClass).toBe('text-light badge badge-workflow');
}); });
}); });

View File

@@ -34,19 +34,19 @@ export class MyDSpaceItemStatusComponent implements OnInit {
this.badgeClass = 'text-light badge '; this.badgeClass = 'text-light badge ';
switch (this.status) { switch (this.status) {
case MyDspaceItemStatusType.VALIDATION: case MyDspaceItemStatusType.VALIDATION:
this.badgeClass += 'badge-warning'; this.badgeClass += 'badge-validation';
break; break;
case MyDspaceItemStatusType.WAITING_CONTROLLER: case MyDspaceItemStatusType.WAITING_CONTROLLER:
this.badgeClass += 'badge-info'; this.badgeClass += 'badge-waiting-controller';
break; break;
case MyDspaceItemStatusType.WORKSPACE: case MyDspaceItemStatusType.WORKSPACE:
this.badgeClass += 'badge-primary'; this.badgeClass += 'badge-workspace';
break; break;
case MyDspaceItemStatusType.ARCHIVED: case MyDspaceItemStatusType.ARCHIVED:
this.badgeClass += 'badge-success'; this.badgeClass += 'badge-archived';
break; break;
case MyDspaceItemStatusType.WORKFLOW: case MyDspaceItemStatusType.WORKFLOW:
this.badgeClass += 'badge-info'; this.badgeClass += 'badge-workflow';
break; break;
} }
} }

View File

@@ -204,3 +204,27 @@ ds-dynamic-form-control-container.d-none {
} }
.badge-validation {
background-color: #{map-get($theme-colors, warning)};
}
.badge-waiting-controller {
background-color: #{map-get($theme-colors, info)};
}
.badge-workspace {
background-color: #{map-get($theme-colors, primary)};
}
.badge-archived {
background-color: #{map-get($theme-colors, success)};
}
.badge-workflow {
background-color: #{map-get($theme-colors, info)};
}
.badge-item-type {
background-color: #{map-get($theme-colors, info)};
}

View File

@@ -1,6 +1,6 @@
nav.navbar { nav.navbar {
border-top: 1px var(--ds-header-navbar-border-top-color) solid; border-top: 1px var(--ds-header-navbar-border-top-color) solid;
border-bottom: 5px var(--bs-green) solid; border-bottom: 5px var(--ds-header-navbar-border-bottom-color) solid;
align-items: baseline; align-items: baseline;
color: var(--ds-header-icon-color); color: var(--ds-header-icon-color);
} }

View File

@@ -6,5 +6,6 @@
--ds-banner-background-gradient-width: 300px; --ds-banner-background-gradient-width: 300px;
--ds-home-news-link-color: #{$green}; --ds-home-news-link-color: #{$green};
--ds-home-news-link-hover-color: #{darken($green, 15%)}; --ds-home-news-link-hover-color: #{darken($green, 15%)};
--ds-header-navbar-border-bottom-color: #{$green};
} }

View File

@@ -10,7 +10,7 @@ $font-family-sans-serif: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI"
$navbar-dark-color: #FFFFFF; $navbar-dark-color: #FFFFFF;
/* Reassign color vars to semantic color scheme */ /* Reassign color vars to semantic color scheme */
$blue: #43515f !default; $blue: #2b4e72 !default;
$green: #92C642 !default; $green: #92C642 !default;
$cyan: #207698 !default; $cyan: #207698 !default;
$yellow: #ec9433 !default; $yellow: #ec9433 !default;
@@ -18,6 +18,7 @@ $red: #CF4444 !default;
$dark: #43515f !default; $dark: #43515f !default;
$gray-800: #343a40 !default; $gray-800: #343a40 !default;
$gray-700: #495057 !default;
$gray-400: #ced4da !default; $gray-400: #ced4da !default;
$gray-100: #f8f9fa !default; $gray-100: #f8f9fa !default;
@@ -27,3 +28,14 @@ $table-accent-bg: $gray-100 !default; // Bootstrap $gray-100
$table-hover-bg: $gray-400 !default; // Bootstrap $gray-400 $table-hover-bg: $gray-400 !default; // Bootstrap $gray-400
$yiq-contrasted-threshold: 170 !default; $yiq-contrasted-threshold: 170 !default;
$theme-colors: (
primary: $dark,
secondary: $gray-700,
success: $green,
info: $cyan,
warning: $yellow,
danger: $red,
light: $gray-100,
dark: $dark
) !default;