Colors
Key Changes:
- New Color System: Migration from custom color names (e.g.,
aqua-pale,common-bright) to a semantic color palette using CSS variables (e.g.,--primary,--secondary,--muted-foreground). Tailwind classes liketext-primary,bg-secondary,text-muted-foregroundshould now be used. - Deprecated Color Classes: Custom color classes like
text-aqua-paleandtext-common-brighthave been removed and need replacement. - Simplified State Classes: Explicit hover/active state classes like
bg-primary-main,hover:bg-primary-light,active:text-primary-lightseem to be replaced by simpler base classes (e.g.,bg-primary) where Tailwind's state variants (hover:,active:) modify the base color, or these states are handled by component variants (e.g., in a Button component). - Component Abstraction: Some styling, especially for interactive elements like buttons, has been abstracted into components (e.g.,
ViewportActionButton, UI library buttons) which use predefined variants (default,secondary,ghost) instead of manual style combinations.
note
You can look at the set of colors in the Color System
Migration Steps:
-
Identify Deprecated Color Classes: Search your codebase for the old custom color classes. The most common ones identified in the diff are:
text-aqua-paletext-common-brighttext-primary-activebg-primary-mainhover:bg-primary-lighthover:text-black(when used with primary hover states)- Potentially others using similar custom names.
-
Replace with New Semantic Colors: Update the deprecated classes with their likely semantic equivalents from the new system. Use the table below as a guide. Note: The exact replacement might depend on the specific context and desired visual outcome. Inspect the element in the browser after changes to ensure it matches the intended design.
Old Class Likely New Class(es) Notes text-aqua-paletext-muted-foregroundUsed for less prominent text, now uses the muted foreground color. text-common-brighttext-foregroundortext-primary-foregroundLikely the default bright text color. text-primary-activetext-primaryortext-highlightSimplified to the base primary color or potentially a highlight color. bg-primary-mainbg-primarySimplified to the base primary background color. text-white(on dark bg)text-foregroundortext-primary-foregroundUse the standard foreground color for the theme. bg-black(for elements)bg-background,bg-popover,bg-card, orbg-mutedUse semantic background colors depending on the element's role. -
Update State Variants and Interactions: Classes managing hover, active, or focus states have likely been simplified or moved into component variants.
- Remove Explicit Hover/Active Styles: Search for combinations like
hover:bg-primary-light,hover:text-black,active:text-primary-lightand remove them if the element now uses a base class likebg-primaryor component variants. Tailwind's built-in state modifiers (hover:,active:) might handle this automatically with the new base colors, or component variants encapsulate these states. - Use Component Variants: If the element is now a component from a UI library (like
Buttonfrom@ohif/ui-next), use its variants (variant="default",variant="secondary",variant="ghost") instead of manual style combinations.
Example Diff:
- <div className="bg-primary-main hover:bg-primary-light text-white hover:text-black rounded p-2">
- Action Button
- </div>
+ <Button variant="default">
+ Action Button
+ </Button>Example Diff:
// Before (in _getStatusComponent.tsx)
- <div
- className="bg-primary-main hover:bg-primary-light ml-1 cursor-pointer rounded px-1.5 hover:text-black"
- onMouseUp={onStatusClick}
- >
- {loadStr}
- </div>
// After (in OHIFCornerstoneRTViewport.tsx using the abstracted component)
+ <ViewportActionButton onInteraction={onStatusClick}>
+ {loadStr}
+ </ViewportActionButton> - Remove Explicit Hover/Active Styles: Search for combinations like