mirror of
https://github.com/azaion/ui.git
synced 2026-04-22 08:46:35 +00:00
63cc18e788
Add local annotation save fallback, PNG+txt download with drawn boxes, shared classColors helper, photo mode icon toggles, and react-dropzone / react-icons dependencies.
25 lines
812 B
TypeScript
25 lines
812 B
TypeScript
const CLASS_COLORS = [
|
|
'#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#FF00FF', '#00FFFF',
|
|
'#800000', '#008000', '#000080', '#808000', '#800080', '#008080',
|
|
]
|
|
|
|
export const FALLBACK_CLASS_NAMES = [
|
|
'Car', 'Person', 'Truck', 'Bicycle', 'Motorcycle', 'Bus',
|
|
'Animal', 'Tree', 'Building', 'Sign', 'Boat', 'Plane',
|
|
]
|
|
|
|
export function getClassColor(classNum: number): string {
|
|
const base = classNum % 20
|
|
return CLASS_COLORS[base % CLASS_COLORS.length]
|
|
}
|
|
|
|
export function getPhotoModeSuffix(classNum: number): string {
|
|
const mode = Math.floor(classNum / 20)
|
|
return mode === 1 ? ' (winter)' : mode === 2 ? ' (night)' : ''
|
|
}
|
|
|
|
export function getClassNameFallback(classNum: number): string {
|
|
const base = classNum % 20
|
|
return FALLBACK_CLASS_NAMES[base % FALLBACK_CLASS_NAMES.length] ?? `#${classNum}`
|
|
}
|