Skip to content

Commit 5998e85

Browse files
justjuanguiclaude
andcommitted
feat(ui): Add dark tooltip background and rarity border color support
- Change tooltip background from light to dark black - Add tooltipBorder line type to TooltipLine for tooltip-level styling - Add borderColor prop to MouseTooltip component - Apply rarity color as border for relic tooltips - Reserve existing color/borderColor/bgColor for future per-line styling Thanks to monddoc for the suggestion! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent dbdf75c commit 5998e85

File tree

5 files changed

+31
-16
lines changed

5 files changed

+31
-16
lines changed

src/lib/hellclock/relics.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,13 @@ export class RelicsHelper {
10101010
this.getRelicRarityColor(relic.rarity as RelicRarity),
10111011
);
10121012

1013+
// Add tooltip border with rarity color
1014+
lines.push({
1015+
text: "",
1016+
type: "tooltipBorder",
1017+
color: rarityColor,
1018+
});
1019+
10131020
// Relic name with rarity color
10141021
lines.push({
10151022
text: relic.name,

src/lib/hellclock/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ export function spriteUrl(sprite?: string): string | undefined {
174174

175175
export interface TooltipLine {
176176
text: string;
177-
color?: string;
178-
borderColor?: string;
179-
bgColor?: string;
177+
color?: string; // for future per-line text color
178+
borderColor?: string; // for future per-line border
179+
bgColor?: string; // for future per-line background
180180
icon?: string;
181-
type: "header" | "info" | "divider" | "affix" | "affixCol";
181+
type: "header" | "info" | "divider" | "affix" | "affixCol" | "tooltipBorder";
182182
}

src/lib/ui/GameTooltip.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
<div class="tooltip-content">
1313
{#each lines as line, i (i)}
14-
{#if line.type === "header"}
14+
{#if line.type === "tooltipBorder"}
15+
<!-- Config-only line, not rendered -->
16+
{:else if line.type === "header"}
1517
<p
1618
class="text-sm text-center font-semibold mb-1"
1719
style={line.color ? `color: ${line.color}` : ""}

src/lib/ui/MouseTooltip.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
edgeMargin?: number;
1818
/** Custom width class (default: w-64) */
1919
widthClass?: string;
20+
/** Custom border color CSS value (e.g., "#ff0000", "rgb(255,0,0)") */
21+
borderColor?: string;
2022
/** Tooltip content */
2123
children: Snippet;
2224
}
@@ -29,6 +31,7 @@
2931
offset = 12,
3032
edgeMargin = 8,
3133
widthClass = "w-64",
34+
borderColor,
3235
children,
3336
}: Props = $props();
3437
@@ -61,7 +64,7 @@
6164
style="left: {position.x}px; top: {position.y}px;"
6265
role="tooltip"
6366
>
64-
<div class="bg-base-100 border border-base-300 rounded-lg shadow-xl p-3">
67+
<div class="bg-black border rounded-lg shadow-xl p-3" style={borderColor ? `border-color: ${borderColor}` : ""}>
6568
{@render children()}
6669
</div>
6770
</div>

src/lib/ui/RelicInventory.svelte

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,19 @@
235235
</div>
236236

237237
<!-- Mouse-following tooltip portal -->
238-
<MouseTooltip
239-
visible={!!activeTooltip}
240-
mouseX={activeTooltip?.state.mouseX ?? 0}
241-
mouseY={activeTooltip?.state.mouseY ?? 0}
242-
placement="right"
243-
>
244-
{#if activeTooltip}
245-
<GameTooltip lines={relicsHelper.getTooltipLines(activeTooltip.relic, lang, statsHelper, skillsHelper)} />
246-
{/if}
247-
</MouseTooltip>
238+
{#if activeTooltip}
239+
{@const lines = relicsHelper.getTooltipLines(activeTooltip.relic, lang, statsHelper, skillsHelper)}
240+
{@const borderColor = lines.find(l => l.type === "tooltipBorder")?.color}
241+
<MouseTooltip
242+
visible={true}
243+
mouseX={activeTooltip.state.mouseX}
244+
mouseY={activeTooltip.state.mouseY}
245+
placement="right"
246+
{borderColor}
247+
>
248+
<GameTooltip {lines} />
249+
</MouseTooltip>
250+
{/if}
248251
</div>
249252

250253
<style>

0 commit comments

Comments
 (0)