From ff34d3942d9670d7455078cf4ff7c0bc4a3aca92 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 31 Mar 2026 20:04:35 +0200 Subject: [PATCH] Add support for image background in world settings --- src/shared-ui/world-background-style.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/shared-ui/world-background-style.ts b/src/shared-ui/world-background-style.ts index 576c9ab1..e88f7f48 100644 --- a/src/shared-ui/world-background-style.ts +++ b/src/shared-ui/world-background-style.ts @@ -2,7 +2,7 @@ import type { CSSProperties } from "react"; import type { WorldBackgroundSettings } from "../document/world-settings"; -export function createWorldBackgroundStyle(background: WorldBackgroundSettings): CSSProperties { +export function createWorldBackgroundStyle(background: WorldBackgroundSettings, imageUrl: string | null = null): CSSProperties { if (background.mode === "solid") { return { backgroundColor: background.colorHex, @@ -10,6 +10,16 @@ export function createWorldBackgroundStyle(background: WorldBackgroundSettings): }; } + if (background.mode === "image") { + return { + backgroundColor: "#0d1116", + backgroundImage: imageUrl === null ? "none" : `url("${imageUrl}")`, + backgroundPosition: "center center", + backgroundRepeat: "no-repeat", + backgroundSize: "cover" + }; + } + return { backgroundColor: background.bottomColorHex, backgroundImage: `linear-gradient(180deg, ${background.topColorHex} 0%, ${background.bottomColorHex} 100%)`