This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects

Resolve "npm packages prüfen"

Merged Michael Breu requested to merge 398-npm-packages-prufen into development
Compare and
3 files
+ 31
17
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { CloudData, CloudOptions } from 'angular-tag-cloud-module';
import { AutoCompletionEntry, SearchService } from 'app/search/service/search-service';
import Color from 'ts-color-class';
import Color from 'colorjs.io';
@Component({
selector: 'jhi-teaser-content',
@@ -36,7 +36,7 @@ export class TeaserContentComponent implements OnInit {
this.keywordCloudData.push({
text: kw.target.toString(),
weight: Math.min(kw.hitCount.valueOf(), 10),
color: this.randomColor('#ffaaee'),
color: this.randomColor('#ff7777'),
})
);
},
@@ -53,7 +53,7 @@ export class TeaserContentComponent implements OnInit {
this.programmingLanguageCloudData.push({
text: pl.target.toString(),
weight: Math.min(pl.hitCount.valueOf(), 10),
color: this.randomColor('#2222ff'),
color: this.randomColor('#7777ff'),
})
);
},
@@ -69,7 +69,7 @@ export class TeaserContentComponent implements OnInit {
this.contributorCloudData.push({
text: pl.target.toString(),
weight: Math.min(pl.hitCount.valueOf(), 10),
color: this.randomColor('#aaff44'),
color: this.randomColor('#77ff77'),
})
);
},
@@ -106,18 +106,32 @@ export class TeaserContentComponent implements OnInit {
private randomColor(mainColorHex: string): string {
try {
const main = new Color(mainColorHex);
const deviation = new Color(mainColorHex);
const deviation = new Color('#FFFFFF');
const redMax = Math.min(main.get('red') * 2, 1.0);
const greenMax = Math.min(main.get('green') * 2, 1.0);
const blueMax = Math.min(main.get('blue') * 2, 1.0);
const red = Math.max(redMax - 2 * deviation.get('red') * Math.random(), 0);
const green = Math.max(greenMax - 2 * deviation.get('green') * Math.random(), 0);
const blue = Math.max(blueMax - 2 * deviation.get('blue') * Math.random(), 0);
const hexString = new Color('srgb', [red, green, blue]).toString({ format: 'hex' });
return hexString;
/*
const upperBound = new Color(
Math.min(main.getRed() + deviation.getRed(), 255),
Math.min(main.getGreen() + deviation.getGreen(), 255),
Math.min(main.getBlue() + deviation.getBlue(), 255)
);
const target2 =
const target = new Color(
Math.max(Math.round(upperBound.getRed() - 2 * deviation.getRed() * Math.random()), 0),
Math.max(Math.round(upperBound.getGreen() - 2 * deviation.getGreen() * Math.random()), 0),
Math.max(Math.round(upperBound.getBlue() - 2 * deviation.getBlue() * Math.random()), 0)
);
return target.getHex();
*/
} catch (e) {
// console.warn("Cannot create Color:" + e.message);
return mainColorHex;