GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix accent color picker: case-insensitive swatch matching, sync custo… · pingdotgg/t3code@14f4f95

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src
    • components/settings
      • ProviderAccentColorPicker.tsx
    • providerInstances.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/settings/ProviderAccentColorPicker.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/settings/ProviderAccentColorPicker.tsx
+26-4Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,20 @@ function ProviderCustomColorPanel(props: {
8787
const { onCommit } = props;
8888
const initialHsv = useMemo(() => hexToHsv(props.value), [props.value]);
8989
const [hsv, setHsv] = useState(initialHsv);
90+
91+
useEffect(() => {
92+
setHsv(initialHsv);
93+
}, [initialHsv]);
94+
9095
const currentColor = hsvToHex(hsv.h, hsv.s, hsv.v);
96+
const [hexInput, setHexInput] = useState(currentColor);
97+
const hexInputFocused = useRef(false);
98+
99+
useEffect(() => {
100+
if (!hexInputFocused.current) {
101+
setHexInput(currentColor);
102+
}
103+
}, [currentColor]);
91104

92105
const commitHsv = useCallback(
93106
(nextHsv: typeof hsv) => {
@@ -162,12 +175,21 @@ function ProviderCustomColorPanel(props: {
162175
/>
163176
</div>
164177
<input
165-
value={currentColor}
178+
value={hexInput}
179+
onFocus={() => {
180+
hexInputFocused.current = true;
181+
}}
182+
onBlur={() => {
183+
hexInputFocused.current = false;
184+
setHexInput(currentColor);
185+
}}
166186
onChange={(event) => {
167187
const nextColor = event.currentTarget.value;
168-
if (!/^#[\da-f]{6}$/i.test(nextColor)) return;
169-
setHsv(hexToHsv(nextColor));
170-
props.onCommit(nextColor);
188+
setHexInput(nextColor);
189+
if (/^#[\da-f]{6}$/i.test(nextColor)) {
190+
setHsv(hexToHsv(nextColor));
191+
props.onCommit(nextColor);
192+
}
171193
}}
172194
className="h-8 rounded-md border border-input bg-background px-2 font-mono text-xs text-foreground outline-none transition-colors focus:border-ring"
173195
aria-label="Custom hex accent color"
Collapse file

‎apps/web/src/providerInstances.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/providerInstances.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function driverKindLabel(driverKind: ProviderDriverKind): string {
8484
export function normalizeProviderAccentColor(value: string | undefined): string | undefined {
8585
const trimmed = value?.trim();
8686
if (!trimmed) return undefined;
87-
return /^#[0-9a-fA-F]{6}$/u.test(trimmed) ? trimmed : undefined;
87+
return /^#[0-9a-fA-F]{6}$/u.test(trimmed) ? trimmed.toLowerCase() : undefined;
8888
}
8989

9090
/**

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.