diff --git a/frontend/src/shared/ui/Tabs.tsx b/frontend/src/shared/ui/Tabs.tsx index 902971b0..3615d202 100644 --- a/frontend/src/shared/ui/Tabs.tsx +++ b/frontend/src/shared/ui/Tabs.tsx @@ -7,9 +7,15 @@ import { cn } from "../lib/cn"; import { IconButton } from "./IconButton"; -import type { ReactNode } from "react"; +import type { CSSProperties, ReactNode } from "react"; import { useI18n } from "@/i18n"; +interface ThemedTabStyle extends CSSProperties { + "--tab-theme-active-bg": string; + "--tab-theme-inactive-bg": string; + "--tab-theme-hover-bg": string; +} + export interface TabItem { /** Stable id, returned by `onSelect`/`onClose`. */ id: string; @@ -44,22 +50,32 @@ export function Tabs({ items, value, onSelect, onClose, className }: TabsProps) > {items.map((tab) => { const active = tab.id === value; + const themedStyle: ThemedTabStyle | undefined = tab.themeColor + ? { + "--tab-theme-active-bg": `color-mix(in srgb, var(--color-raised) 90%, ${tab.themeColor})`, + // 5% project colour is 25% stronger than the previous 4% tint. + "--tab-theme-inactive-bg": `color-mix(in srgb, var(--color-raised) 95%, ${tab.themeColor})`, + "--tab-theme-hover-bg": `color-mix(in srgb, var(--color-raised) 93%, ${tab.themeColor})`, + ...(active ? { borderColor: tab.themeAccent ?? tab.themeColor } : {}), + } + : undefined; return (