Skip to content

Commit

Permalink
improved color scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
rsiminel committed Jul 10, 2024
1 parent f0d2675 commit a331f86
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions manager2/src/app/tps/tps.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { CalendarEvent, CalendarEventTimesChangedEvent } from 'angular-calendar'
import { Subject } from 'rxjs';

const eventColors = {
created: { primary: '#00dd00' },
pending: { primary: '#00aabb' },
over: { primary: '#0000ff' }
created: { primary: '#00dd44' },
pending: { primary: '#0066ff' },
over: { primary: '#808080' }
};

@Component({
Expand Down Expand Up @@ -54,14 +54,15 @@ export class TpsComponent implements OnInit {
) { }

private choseColor(id: string, over: boolean, created: boolean) {
let baseColor;
if (over) { baseColor = eventColors.over; }
else if (created) { baseColor = eventColors.created; }
else { baseColor = eventColors.pending; }
let color = { ...baseColor }
const hash = id.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
const red = (hash % 128).toString(16).padStart(2, '0');
color.primary = `#${red}${color.primary.slice(3)}`;
let color;
if (over) { color = eventColors.over; }
else {
if (created) { color = eventColors.created; }
else { color = eventColors.pending; }
const hash = id.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
const red = (3*hash % 128).toString(16).padStart(2, '0');
color.primary = `#${red}${color.primary.slice(3)}`;
}
return color;
}

Expand Down

0 comments on commit a331f86

Please sign in to comment.