File tree Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Expand file tree Collapse file tree 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 {
9797 }
9898}
9999
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-
110100function fallbackColor ( str : string ) : string {
111101 // Get fallback color
112102 // 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';
44import Color from 'color' ;
55import _ from 'lodash' ;
66
7- import { getCategoryColor , getCategoryColorFromString } from '~/util/color' ;
7+ import { useCategoryStore } from '~/stores/categories' ;
8+ import { getCategoryColorFromString } from '~/util/color' ;
89import { seconds_to_duration } from '~/util/time' ;
910import { IEvent } from '~/util/interfaces' ;
1011
@@ -73,7 +74,8 @@ function update(container: HTMLElement, apps: Entry[]) {
7374
7475 let appcolor : string ;
7576 if ( Array . isArray ( app . colorKey ) ) {
76- appcolor = getCategoryColor ( app . colorKey ) ;
77+ const categoryStore = useCategoryStore ( ) ;
78+ appcolor = categoryStore . get_category_color ( app . colorKey ) ;
7779 } else {
7880 appcolor = app . color || getCategoryColorFromString ( app . colorKey || app . name ) ;
7981 }
You can’t perform that action at this time.
0 commit comments