diff options
| author | Sophie Zhang <sophie_zhang@brown.edu> | 2023-07-19 14:16:35 -0400 |
|---|---|---|
| committer | Sophie Zhang <sophie_zhang@brown.edu> | 2023-07-19 14:16:35 -0400 |
| commit | e0c100ecb1fe2b16209e955911f7e8267a2535ef (patch) | |
| tree | 4f308feaa3be046f26d43f20917a8744858b14e0 /src/client/util/reportManager/reportManagerUtils.ts | |
| parent | 3cdb72716ed161f1e421e1bf4a2f8f009e221e00 (diff) | |
ui changes
Diffstat (limited to 'src/client/util/reportManager/reportManagerUtils.ts')
| -rw-r--r-- | src/client/util/reportManager/reportManagerUtils.ts | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/src/client/util/reportManager/reportManagerUtils.ts b/src/client/util/reportManager/reportManagerUtils.ts index 66394a0ca..682113a89 100644 --- a/src/client/util/reportManager/reportManagerUtils.ts +++ b/src/client/util/reportManager/reportManagerUtils.ts @@ -18,11 +18,16 @@ export enum BugType { 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': ['#0f4ce7', '#ffffff'], + 'priority-high': ['#003cd5', '#ffffff'], }; // [bgColor, color] @@ -45,10 +50,35 @@ export const getLabelColors = (label: string): string[] => { return ['#0f73f6', '#ffffff']; }; -export interface FileData { - _id: string; - file: File; -} +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 inactiveBorderColor = '#b8b8b8'; -export const inactiveColor = '#808080'; +export const lightColors = { + text: '#000000', + textGrey: '#5c5c5c', + border: '#b8b8b8', +}; + +export const darkColors = { + text: '#ffffff', + textGrey: '#d6d6d6', + border: '#717171', +}; |
