Skip to content
This repository was archived by the owner on Oct 21, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions apps/web/src/components/settings/ProviderAccentColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import { cn } from "../../lib/utils";

const FALLBACK_ACCENT_COLOR = "#2563eb";

function ProviderCustomColorPanel(props: {
export function ProviderCustomColorPanel(props: {
readonly value: string;
readonly onCommit: (value: string) => void;
readonly label?: string;
}) {
const { onCommit } = props;
const { label = "Accent color", onCommit } = props;
const [hsv, setHsv] = useState(() => hexToHsv(props.value));
const currentColor = hsvToHex(hsv.h, hsv.s, hsv.v);
const [hexDraft, setHexDraft] = useState<string | null>(null);
Expand All @@ -32,15 +33,10 @@ function ProviderCustomColorPanel(props: {

return (
<div className="w-56 bg-popover">
<ColorSaturationValuePlane
label="Accent color"
value={hsv}
onChange={commitHsv}
variant="edge"
/>
<ColorSaturationValuePlane label={label} value={hsv} onChange={commitHsv} variant="edge" />
<div className="grid gap-3 p-3">
<ColorHueSlider
label="Accent color hue"
label={`${label} hue`}
value={hsv.h}
onChange={(h) => commitHsv({ ...hsv, h })}
/>
Expand All @@ -57,7 +53,7 @@ function ProviderCustomColorPanel(props: {
}}
onBlur={() => setHexDraft(null)}
font="mono"
aria-label="Custom hex accent color"
aria-label={`Custom hex ${label.toLowerCase()}`}
spellCheck={false}
/>
</div>
Expand Down
50 changes: 49 additions & 1 deletion apps/web/src/components/settings/ProviderProfilesSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
type UnifiedSettings,
} from "@t3tools/contracts";
import { createModelSelection } from "@t3tools/shared/model";
import { PencilIcon, PlusIcon } from "lucide-react";
import { PencilIcon, PipetteIcon, PlusIcon } from "lucide-react";
import { useMemo, useState } from "react";

import { useUpdateEnvironmentSettings } from "../../hooks/useSettings";
Expand Down Expand Up @@ -44,6 +44,8 @@ import {
providerProfileIdFromName,
resolveProjectProviderProfileId,
} from "./ProviderProfilesSettings.logic";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
import { ProviderCustomColorPanel } from "./ProviderAccentColorPicker";
import { searchableSetting } from "./settingsSearch";
import { SETTINGS_PICKER_TRIGGER_CLASSNAME, SettingsRow, SettingsSection } from "./settingsLayout";

Expand Down Expand Up @@ -233,6 +235,48 @@ export function ProviderProfilesSettings({
);
}

/** The last swatch in the profile color row: shows a custom color once picked, and edits it. */
function ProviderProfileCustomColor({
value,
onChange,
}: {
value: string | undefined;
onChange: (color: string) => void;
}) {
const custom =
value && !(PROVIDER_PROFILE_COLORS as readonly string[]).includes(value) ? value : undefined;
return (
<Popover>
<PopoverTrigger
render={
<button
type="button"
role="radio"
aria-checked={custom !== undefined}
aria-label="Custom color"
className={cn(
"flex size-5 cursor-pointer items-center justify-center rounded-full ring-offset-2 ring-offset-background outline-none focus-visible:ring-2 focus-visible:ring-ring",
custom
? "ring-2 ring-foreground/60"
: "border border-dashed border-muted-foreground/60",
)}
style={custom ? { background: custom } : undefined}
>
{custom ? null : <PipetteIcon className="size-3 text-muted-foreground" aria-hidden />}
</button>
}
/>
<PopoverPopup side="bottom" align="end" sideOffset={6} padding="none">
<ProviderCustomColorPanel
label="Profile color"
value={custom ?? value ?? PROVIDER_PROFILE_COLORS[0]}
onCommit={onChange}
/>
</PopoverPopup>
</Popover>
);
}

function ProviderProfileEditorDialog({
initial,
entries,
Expand Down Expand Up @@ -337,6 +381,10 @@ function ProviderProfileEditorDialog({
style={{ background: color }}
/>
))}
<ProviderProfileCustomColor
value={draft.color}
onChange={(color) => setDraft({ ...draft, color })}
/>
</div>
</div>
</div>
Expand Down
Loading