diff --git a/frontend/src/index.css b/frontend/src/index.css index a195e44..f366b39 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -44,6 +44,7 @@ --badge-blue-text: #63b3ed; } + --color-default: #000000; /* Ensure all interactive elements show pointer cursor */ button, [role="button"], diff --git a/frontend/src/melodies/MelodyForm.jsx b/frontend/src/melodies/MelodyForm.jsx index 9282eed..ed2db99 100644 --- a/frontend/src/melodies/MelodyForm.jsx +++ b/frontend/src/melodies/MelodyForm.jsx @@ -219,7 +219,7 @@ export default function MelodyForm() { form="melody-form" disabled={saving || uploading} className="px-4 py-2 text-sm rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors" - style={{ backgroundColor: "var(--btn-primary)", color: "var(--text-heading)" }} + style={{ backgroundColor: "var(--btn-primary)", color: "var(--text-white)" }} > {uploading ? "Uploading files..." : saving ? "Saving..." : isEdit ? "Update Melody" : "Create Melody"} @@ -333,11 +333,10 @@ export default function MelodyForm() { Custom - updateInfo("color", e.target.value)} className="absolute inset-0 opacity-0 w-full h-full cursor-pointer" /> + updateInfo("color", e.target.value)} className="absolute inset-0 opacity-0 w-full h-full cursor-pointer" /> - - style={{ backgroundColor: "var(--btn-primary)", color: "var(--text-white)" }} +
updateInfo("isTrueRing", e.target.checked)} className="h-4 w-4 rounded" /> diff --git a/frontend/src/melodies/MelodySettings.jsx b/frontend/src/melodies/MelodySettings.jsx index 80b0041..e41ddb8 100644 --- a/frontend/src/melodies/MelodySettings.jsx +++ b/frontend/src/melodies/MelodySettings.jsx @@ -23,8 +23,11 @@ export default function MelodySettings() { const [success, setSuccess] = useState(""); const [langToAdd, setLangToAdd] = useState(""); - const [colorToAdd, setColorToAdd] = useState("#FF0000"); - const [colorHexInput, setColorHexInput] = useState("#FF0000"); + const cssColorDefault = (typeof window !== "undefined" && window.getComputedStyle) + ? getComputedStyle(document.documentElement).getPropertyValue("--color-default").trim() + : "var(--color-default)"; + const [colorToAdd, setColorToAdd] = useState(cssColorDefault); + const [colorHexInput, setColorHexInput] = useState(cssColorDefault); const [durationToAdd, setDurationToAdd] = useState(""); useEffect(() => { @@ -231,7 +234,7 @@ export default function MelodySettings() { type="text" value={colorHexInput} onChange={(e) => { setColorHexInput(e.target.value); if (/^#[0-9A-Fa-f]{6}$/.test(e.target.value)) setColorToAdd(e.target.value); }} - placeholder="#FF0000" + placeholder="#RRGGBB" className="w-28 px-3 py-2 rounded-md text-sm font-mono border" /> diff --git a/frontend/src/melodies/melodyUtils.js b/frontend/src/melodies/melodyUtils.js index be0aab0..ab4c6bb 100644 --- a/frontend/src/melodies/melodyUtils.js +++ b/frontend/src/melodies/melodyUtils.js @@ -48,7 +48,17 @@ export function getLocalizedValue(value, lang, fallback = "") { * Converts "0xFFRRGGBB" or "0xRRGGBB" format to "#RRGGBB". */ export function normalizeColor(val) { - if (!val) return "#000000"; + if (!val) { + try { + if (typeof window !== "undefined" && window.getComputedStyle) { + const v = getComputedStyle(document.documentElement).getPropertyValue("--color-default").trim(); + if (v) return v; + } + } catch (e) { + // fallthrough + } + return "var(--color-default)"; + } if (val.startsWith("0x") || val.startsWith("0X")) { const hex = val.slice(2); // If 8 chars (AARRGGBB), skip alpha