File tree 2 files changed +4
-12
lines changed
2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -97,16 +97,6 @@ export function getCategoryColorFromString(str: string): string {
97
97
}
98
98
}
99
99
100
- export function getCategoryColor ( category_name : string [ ] ) : string {
101
- // TODO: Don't load classes on every call
102
- const allCats = loadClasses ( ) ;
103
- const c = allCats . find ( cat => _ . isEqual ( cat . name , category_name ) ) ;
104
- if ( c !== undefined ) {
105
- return getColorFromCategory ( c , allCats ) ;
106
- }
107
- return fallbackColor ( category_name . join ( ' > ' ) ) ;
108
- }
109
-
110
100
function fallbackColor ( str : string ) : string {
111
101
// Get fallback color
112
102
// TODO: Fetch setting from somewhere better, where defaults are respected
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ import * as d3 from 'd3';
4
4
import Color from 'color' ;
5
5
import _ from 'lodash' ;
6
6
7
- import { getCategoryColor , getCategoryColorFromString } from '~/util/color' ;
7
+ import { useCategoryStore } from '~/stores/categories' ;
8
+ import { getCategoryColorFromString } from '~/util/color' ;
8
9
import { seconds_to_duration } from '~/util/time' ;
9
10
import { IEvent } from '~/util/interfaces' ;
10
11
@@ -73,7 +74,8 @@ function update(container: HTMLElement, apps: Entry[]) {
73
74
74
75
let appcolor : string ;
75
76
if ( Array . isArray ( app . colorKey ) ) {
76
- appcolor = getCategoryColor ( app . colorKey ) ;
77
+ const categoryStore = useCategoryStore ( ) ;
78
+ appcolor = categoryStore . get_category_color ( app . colorKey ) ;
77
79
} else {
78
80
appcolor = app . color || getCategoryColorFromString ( app . colorKey || app . name ) ;
79
81
}
You can’t perform that action at this time.
0 commit comments