-- Additive registry change only: existing explicit preferences remain untouched. SET ANSI_NULLS ON; GO SET QUOTED_IDENTIFIER ON; GO CREATE OR ALTER PROCEDURE dbo.UserAppearance_SaveTheme @UserID int, @ThemeKey nvarchar(32), @OnlyIfUnset bit = 0 AS BEGIN SET NOCOUNT ON; IF @ThemeKey NOT IN ('plotdirector','modern-light','modern-dark','warm-light','warm-dark','rose-pink','baby-blue') OR @ThemeKey IS NULL THROW 50001, 'Unknown application theme', 1; UPDATE dbo.AppUser SET ApplicationThemeKey = @ThemeKey WHERE UserID = @UserID AND (@OnlyIfUnset = 0 OR ApplicationThemeKey IS NULL); END; GO