Mercurial > hg > ugly-duckling
changeset 272:74f36b4777ff
Merge branch 'master' of github.com:cannam/ugly-duckling into cc-vertical-scale
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Tue, 02 May 2017 21:31:19 +0100 |
parents | 9c9ac77d7448 (diff) 88ac87b1800e (current diff) |
children | ce44d0fbda3b |
files | src/app/waveform/waveform.component.ts |
diffstat | 2 files changed, 18 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/app/waveform/waveform.component.ts Tue May 02 18:10:51 2017 +0100 +++ b/src/app/waveform/waveform.component.ts Tue May 02 21:31:19 2017 +0100 @@ -32,21 +32,24 @@ type Track = any; type Colour = string; -const colours = function* () { - const circularColours = [ - '#0868ac', // "sapphire blue", our waveform / header colour - '#c33c54', // "brick red" - '#17bebb', // "tiffany blue" - '#001021', // "rich black" - '#fa8334', // "mango tango" - '#034748' // "deep jungle green" - ]; + + +function* createColourGenerator(colours) { let index = 0; - const nColours = circularColours.length; + const nColours = colours.length; while (true) { - yield circularColours[index = ++index % nColours]; + yield colours[index = ++index % nColours]; } -}(); +} + +const defaultColourGenerator = createColourGenerator([ + '#0868ac', // "sapphire blue", our waveform / header colour + '#c33c54', // "brick red" + '#17bebb', // "tiffany blue" + '#001021', // "rich black" + '#fa8334', // "mango tango" + '#034748' // "deep jungle green" +]); @Component({ selector: 'ugly-waveform', @@ -65,11 +68,11 @@ if (this.featureExtractionSubscription) { return; } - + this.featureExtractionSubscription = this.piperService.featuresExtracted$.subscribe( features => { - this.renderFeatures(features, colours.next().value); + this.renderFeatures(features, defaultColourGenerator.next().value); }); } else { if (this.featureExtractionSubscription) {
--- a/tslint.json Tue May 02 18:10:51 2017 +0100 +++ b/tslint.json Tue May 02 21:31:19 2017 +0100 @@ -51,7 +51,7 @@ "no-string-literal": false, "no-string-throw": true, "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, + "no-trailing-whitespace": false, "no-unused-expression": true, "no-use-before-declare": true, "no-var-keyword": true,