Remove unused code. Add utils.ts

This commit is contained in:
schooltechx 2023-04-10 14:41:43 +07:00
parent 0348e6b72e
commit ea07766fd8
9 changed files with 34 additions and 112 deletions

15
cms/src/lib/utils.ts Normal file
View file

@ -0,0 +1,15 @@
/**
* getColorDict()
* get color base on name, add to nameColor if name not exist.
* Use for event background color of FullCalendar
* @param name string of color name
* @param nameColor dictionary like object for name and color
*/
export function getBgColorDict(name:string,nameColor:{ [index: string]:string}){
const eventBg = ["#23ccef","rgba(251,64,75,.2)","rgba(68,125,247,.2)","rgba(64,251,75,.2)"]
if(!nameColor[name]){
const len = Object.keys(nameColor).length
nameColor[name]=len>eventBg.length?eventBg[0]:eventBg[len]
}
return nameColor[name]
}