@@ -63,6 +63,22 @@ export class CircularHeatmapComponent implements OnInit {
6363 showOverlay : boolean ;
6464 showFilters : boolean ;
6565 markdown : md = md ( ) ;
66+ theme : string ;
67+ theme_colors : Record < string , string > ;
68+ themes : Record < string , Record < string , string > > = {
69+ light : {
70+ background : '#ffffff' ,
71+ disabled : '#dddddd' ,
72+ filled : 'green' ,
73+ cursor : 'green' ,
74+ } ,
75+ night : {
76+ background : '#dddddd' ,
77+ disabled : '#888888' ,
78+ filled : 'green' ,
79+ cursor : 'green' ,
80+ } ,
81+ } ;
6682
6783 constructor (
6884 private yaml : ymlService ,
@@ -71,10 +87,15 @@ export class CircularHeatmapComponent implements OnInit {
7187 ) {
7288 this . showOverlay = false ;
7389 this . showFilters = true ;
90+ this . theme = 'light' ;
91+ this . theme_colors = this . themes [ this . theme ] ;
7492 }
7593
7694 ngOnInit ( ) : void {
7795 console . log ( `${ this . perfNow ( ) } s: ngOnInit` ) ;
96+ this . theme = localStorage . getItem ( 'theme' ) || 'light' ;
97+ this . theme_colors = this . themes [ this . theme ] ;
98+
7899 // Ensure that Levels and Teams load before MaturityData
79100 // using promises, since ngOnInit does not support async/await
80101 this . LoadMaturityLevels ( )
@@ -405,7 +426,6 @@ export class CircularHeatmapComponent implements OnInit {
405426 . innerRadius ( innerRadius )
406427 . segmentHeight ( segmentHeight )
407428 . domain ( [ 0 , 1 ] )
408- . range ( [ 'white' , 'green' ] )
409429 . radialLabels ( radial_labels )
410430 . segmentLabels ( segment_labels ) ;
411431
@@ -498,6 +518,7 @@ export class CircularHeatmapComponent implements OnInit {
498518 var segmentLabels : any [ ] = [ ] ;
499519
500520 //console.log(segmentLabels)
521+ let _self : any = this ;
501522
502523 function chart ( selection : any ) {
503524 selection . each ( function ( this : any , data : any ) {
@@ -611,7 +632,7 @@ export class CircularHeatmapComponent implements OnInit {
611632 . append ( 'path' )
612633 . attr ( 'id' , 'hover' )
613634 . attr ( 'pointer-events' , 'none' )
614- . attr ( 'stroke' , 'green' )
635+ . attr ( 'stroke' , _self . theme_colors [ 'cursor' ] )
615636 . attr ( 'stroke-width' , '7' )
616637 . attr ( 'fill' , 'transparent' ) ;
617638 cursors
@@ -716,7 +737,7 @@ export class CircularHeatmapComponent implements OnInit {
716737 noActivitytoGrey ( ) : void {
717738 for ( var x = 0 ; x < this . ALL_CARD_DATA . length ; x ++ ) {
718739 if ( this . ALL_CARD_DATA [ x ] [ 'Done%' ] == - 1 ) {
719- d3 . select ( '#index-' + x ) . attr ( 'fill' , '#DCDCDC' ) ;
740+ d3 . select ( '#index-' + x ) . attr ( 'fill' , this . theme_colors [ 'disabled' ] ) ;
720741 }
721742 }
722743 }
@@ -822,7 +843,7 @@ export class CircularHeatmapComponent implements OnInit {
822843 var colorSector = d3
823844 . scaleLinear < string , string > ( )
824845 . domain ( [ 0 , 1 ] )
825- . range ( [ 'white' , 'green' ] ) ;
846+ . range ( [ this . theme_colors [ 'background' ] , this . theme_colors [ 'filled' ] ] ) ;
826847
827848 if ( cntAll !== 0 ) {
828849 this . ALL_CARD_DATA [ index ] [ 'Done%' ] = cntTrue / cntAll ;
@@ -833,7 +854,10 @@ export class CircularHeatmapComponent implements OnInit {
833854 } else {
834855 this . ALL_CARD_DATA [ index ] [ 'Done%' ] = - 1 ;
835856 // console.log(`${this.ALL_CARD_DATA[index].SubDimension} ${this.ALL_CARD_DATA[index].Level} None`);
836- d3 . select ( '#index-' + index ) . attr ( 'fill' , '#DCDCDC' ) ;
857+ d3 . select ( '#index-' + index ) . attr (
858+ 'fill' ,
859+ this . theme_colors [ 'disabled' ]
860+ ) ;
837861 }
838862 }
839863 }
0 commit comments