Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

make color pickers actually functional

Brendan Alland4dce6b06e72
diff --git a/apps/desktop-solid/src/routes/editor/Editor.tsx b/apps/desktop-solid/src/routes/editor/Editor.tsx
index 66ebb2dbd..ac721e82b 100644
--- a/apps/desktop-solid/src/routes/editor/Editor.tsx
+++ b/apps/desktop-solid/src/routes/editor/Editor.tsx
@@ -1180,13 +1180,26 @@ function RgbInput(props: {
const [text, setText] = createSignal(rgbToHex(props.value));
let prevHex = rgbToHex(props.value);
+ let colorInput: HTMLInputElement;
+
return (
- <div class="flex flex-row items-center gap-[0.75rem]">
- <div
+ <div class="flex flex-row items-center gap-[0.75rem] relative">
+ <button
+ type="button"
class="size-[3rem] rounded-[0.5rem]"
style={{
"background-color": rgbToHex(props.value),
}}
+ onClick={() => colorInput.click()}
+ />
+ <input
+ ref={colorInput!}
+ type="color"
+ class="absolute left-0 bottom-0 w-[3rem] opacity-0"
+ onChange={(e) => {
+ const value = hexToRgb(e.target.value);
+ if (value) props.onChange(value);
+ }}
/>
<input
class="w-[5rem] p-[0.375rem] border text-gray-400 rounded-[0.5rem]"
diff --git a/apps/desktop-solid/src/routes/editor/context.ts b/apps/desktop-solid/src/routes/editor/context.ts
index a26242772..7aa519a60 100644
--- a/apps/desktop-solid/src/routes/editor/context.ts
+++ b/apps/desktop-solid/src/routes/editor/context.ts
@@ -58,7 +58,7 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(
const [selectedTab, setSelectedTab] = createSignal<
"background" | "camera" | "transcript" | "audio" | "cursor" | "hotkeys"
- >("camera");
+ >("background");
const [canvasRef, setCanvasRef] = createSignal<HTMLCanvasElement | null>(
null