Overview
TheLabelColor type defines a color scheme for rendering annotation labels. Each color scheme includes multiple variants for different visual contexts, ensuring consistent styling across the UI.
Type Definition
types.ts
Properties
The solid color used for borders, badges, and text labels. Typically an HSL color with high saturation.Example:
"hsl(210 70% 40%)"A very light background color for tags or badges. Has low saturation and high lightness.Example:
"hsl(210 95% 96%)"A semi-transparent overlay color for annotation boxes (default state). Uses alpha transparency around 14%.Example:
"hsl(210 85% 45% / 0.14)"A slightly more opaque overlay for selected or hovered annotation boxes. Uses alpha transparency around 24%.Example:
"hsl(210 85% 45% / 0.24)"Usage
Generating Random Colors
ThebuildRandomLabelColor utility generates a random color scheme:
Applying Colors in the UI
Colors are applied to annotation boxes and labels:App.tsx
Color Generation
ThebuildRandomLabelColor utility generates colors using HSL:
color.ts
Color Variants Summary
| Variant | Saturation | Lightness | Opacity | Use Case |
|---|---|---|---|---|
solid | 70% | 40% | 100% | Borders, badges, text |
soft | 95% | 96% | 100% | Light backgrounds |
overlay | 85% | 45% | 14% | Default box fill |
overlayStrong | 85% | 45% | 24% | Selected box fill |
Related Utilities
- buildRandomLabelColor - Generates a random LabelColor scheme