Skip to content

Commit a9ebbb0

Browse files
committed
Use native shadcn color scheme for tooltips
Added missing shadcn semantic colors to theme: - --color-primary: hsl(0 0% 18%) - dark background - --color-primary-foreground: hsl(0 0% 98%) - light text Updated tooltip to use native shadcn utilities: - bg-primary (instead of hardcoded colors) - text-primary-foreground - fill-primary (for arrow) This follows the standard shadcn/ui tooltip pattern and should work with Tailwind's utility generation.
1 parent 8f68ea7 commit a9ebbb0

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/components/ui/tooltip.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,18 @@ const TooltipTrigger = TooltipPrimitive.Trigger;
1212
const TooltipContent = React.forwardRef<
1313
React.ElementRef<typeof TooltipPrimitive.Content>,
1414
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
15-
>(({ className, sideOffset = 4, style, ...props }, ref) => (
15+
>(({ className, sideOffset = 4, ...props }, ref) => (
1616
<TooltipPrimitive.Content
1717
ref={ref}
1818
sideOffset={sideOffset}
19-
className={cn("z-50 rounded-md px-2.5 py-1 text-xs shadow-md", className)}
20-
style={{
21-
backgroundColor: "#2d2d2d",
22-
color: "#d4d4d4",
23-
border: "1px solid #404040",
24-
...style,
25-
}}
19+
className={cn(
20+
"z-50 overflow-hidden rounded-md bg-primary px-2.5 py-1 text-xs text-primary-foreground shadow-md",
21+
className
22+
)}
2623
{...props}
2724
>
2825
{props.children}
29-
<TooltipPrimitive.Arrow style={{ fill: "#2d2d2d" }} />
26+
<TooltipPrimitive.Arrow className="fill-primary" />
3027
</TooltipPrimitive.Content>
3128
));
3229
TooltipContent.displayName = TooltipPrimitive.Content.displayName;

src/styles/globals.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
--color-ring: hsl(207 100% 40%); /* focus ring - uses accent */
4444
--color-muted-foreground: hsl(0 0% 60%); /* muted text */
4545
--color-accent-foreground: hsl(0 0% 98%); /* white text on accent */
46+
--color-primary: hsl(0 0% 18%); /* primary - dark for tooltips */
47+
--color-primary-foreground: hsl(0 0% 98%); /* white text on primary */
4648

4749
/* Code */
4850
--color-code-bg: hsl(0 6.43% 8.04%);
@@ -205,6 +207,8 @@
205207
--color-border: hsl(240 2% 25%);
206208
--color-popover: hsl(0 0% 18%);
207209
--color-popover-foreground: hsl(0 0% 83%);
210+
--color-primary: hsl(0 0% 18%);
211+
--color-primary-foreground: hsl(0 0% 98%);
208212
--color-text: hsl(0 0% 83%);
209213
--color-text-secondary: hsl(0 0% 42%);
210214
--color-user-border: hsl(0 0% 38%);

0 commit comments

Comments
 (0)