// Final file url reference: "https://browndash.com/files/images/upload_cb31bc0fda59c96ca14193ec494f80cf_o.jpg" /> export enum ViewState { VIEW, CREATE, } export enum Priority { HIGH = 'priority-high', MEDIUM = 'priority-medium', LOW = 'priority-low', } export enum BugType { BUG = 'bug', COSMETIC = 'cosmetic', DOCUMENTATION = 'documentation', ENHANCEMENT = 'enhancement', } export interface FileData { _id: string; file: File; } // [bgColor, color] export const priorityColors: { [key: string]: string[] } = { 'priority-low': ['#d4e0ff', '#000000'], 'priority-medium': ['#6a91f6', '#ffffff'], 'priority-high': ['#003cd5', '#ffffff'], }; // [bgColor, color] export const bugColors: { [key: string]: string[] } = { bug: ['#fe6d6d', '#ffffff'], cosmetic: ['#c650f4', '#ffffff'], documentation: ['#36acf0', '#ffffff'], enhancement: ['#36d4f0', '#ffffff'], }; export const prioritySet = new Set(Object.values(Priority)); export const bugSet = new Set(Object.values(BugType)); export const getLabelColors = (label: string): string[] => { if (prioritySet.has(label as Priority)) { return priorityColors[label]; } else if (bugSet.has(label as BugType)) { return bugColors[label]; } return ['#0f73f6', '#ffffff']; }; const hexToRgb = (hex: string) => { const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16), } : { r: 0, g: 0, b: 0, }; }; // function that returns whether text should be light on the given bg color export const isLightText = (bgHex: string): boolean => { const { r, g, b } = hexToRgb(bgHex); return r * 0.299 + g * 0.587 + b * 0.114 <= 186; }; export const lightColors = { text: '#000000', textGrey: '#5c5c5c', border: '#b8b8b8', }; export const darkColors = { text: '#ffffff', textGrey: '#d6d6d6', border: '#717171', };