Repository: tauri-apps/tauri (language: rust)

Issue:
[bug][js API] setBackgroundColor
### Describe the bug

Hi, following this PR https://github.com/tauri-apps/tauri/pull/11486,
I'm trying to set the background color of the webview's window via the Js API

```js
import { getCurrentWindow } from '@tauri-apps/api/window';

const window = getCurrentWindow();
await window.setBackgroundColor(theme === 'Dark' ? '#1C1B1F' : '#F2F4F6');
```

But at runtime, it fails with the following error `window.set_background_color not allowed. Command not found`

It looks like a permissions issue? But so far can't figure out what is the expected one.

### Reproduction

_No response_

### Expected behavior

_No response_

### Full `tauri info` output

```text
[✔] Environment
    - OS: Arch Linux Unknown x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.46.3
    ✔ rsvg2: 2.59.2
    ✔ rustc: 1.83.0 (90b35a623 2024-11-26)
    ✔ cargo: 1.83.0 (5ffbef321 2024-10-29)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 20.13.1
    - npm: 10.8.2
    - bun: 1.1.22

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.0
    - tao 🦀: 0.30.8
    - tauri-cli 🦀: 2.0.4
    - @tauri-apps/api : 2.1.1
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-process 🦀: 2.0.1
    - @tauri-apps/plugin-process : 2.0.0
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1
    - tauri-plugin-single-instance 🦀: 2.0.1
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-updater 🦀: 2.0.2
    - @tauri-apps/plugin-updater : 2.0.0
    - tauri-plugin-window-state 🦀: 2.0.2
    - @tauri-apps/plugin-window-state : 2.0.0
    - tauri-plugin-fs 🦀: 2.0.3
    - @tauri-apps/plugin-fs : not installed!
    - tauri-plugin-notification 🦀: 2.0.1
    - @tauri-apps/plugin-notification : 2.0.0
    - tauri-plugin-dialog 🦀: 2.0.3
    - @tauri-apps/plugin-dialog : 2.0.1
    - tauri-plugin-os 🦀: 2.0.1
    - @tauri-apps/plugin-os : 2.0.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite
```


### Stack trace

_No response_

### Additional context

_No response_


Discussion / hints:

Fix patch:
diff --git a/.changes/core-background-color-permissions.md b/.changes/core-background-color-permissions.md
new file mode 100644
index 000000000000..c09ed3727cf6
--- /dev/null
+++ b/.changes/core-background-color-permissions.md
@@ -0,0 +1,5 @@
+---
+tauri: "patch:bug"
+---
+
+Add webview and window color setters to autogenerated permissions.
diff --git a/crates/tauri/build.rs b/crates/tauri/build.rs
index 92a8ca2c090a..6d42d967b4ce 100644
--- a/crates/tauri/build.rs
+++ b/crates/tauri/build.rs
@@ -112,6 +112,7 @@ const PLUGINS: &[(&str, &[(&str, bool)])] = &[
       ("set_title_bar_style", false),
       ("set_theme", false),
       ("toggle_maximize", false),
+      ("set_background_color", false),
       // internal
       ("internal_toggle_maximize", true),
     ],
@@ -136,6 +137,7 @@ const PLUGINS: &[(&str, &[(&str, bool)])] = &[
       ("print", false),
       ("reparent", false),
       ("clear_all_browsing_data", false),
+      ("set_webview_background_color", false),
       // internal
       ("internal_toggle_devtools", true),
     ],
diff --git a/crates/tauri/permissions/webview/autogenerated/reference.md b/crates/tauri/permissions/webview/autogenerated/reference.md
index a17954705c7e..9bb12aab8ae9 100644
--- a/crates/tauri/permissions/webview/autogenerated/reference.md
+++ b/crates/tauri/permissions/webview/autogenerated/reference.md
@@ -201,6 +201,32 @@ Denies the reparent command without any pre-configured scope.
 <tr>
 <td>
 
+`core:webview:allow-set-webview-background-color`
+
+</td>
+<td>
+
+Enables the set_webview_background_color command without any pre-configured scope.
+
+</td>
+</tr>
+
+<tr>
+<td>
+
+`core:webview:deny-set-webview-background-color`
+
+</td>
+<td>
+
+Denies the set_webview_background_color command without any pre-configured scope.
+
+</td>
+</tr>
+
+<tr>
+<td>
+
 `core:webview:allow-set-webview-focus`
 
 </td>
diff --git a/crates/tauri/permissions/window/autogenerated/reference.md b/crates/tauri/permissions/window/autogenerated/reference.md
index 61648e79bbf7..55f06628639c 100644
--- a/crates/tauri/permissions/window/autogenerated/reference.md
+++ b/crates/tauri/permissions/window/autogenerated/reference.md
@@ -898,6 +898,32 @@ Denies the set_always_on_top command without any pre-configured scope.
 <tr>
 <td>
 
+`core:window:allow-set-background-color`
+
+</td>
+<td>
+
+Enables the set_background_color command without any pre-configured scope.
+
+</td>
+</tr>
+
+<tr>
+<td>
+
+`core:window:deny-set-background-color`
+
+</td>
+<td>
+
+Denies the set_background_color command without any pre-configured scope.
+
+</td>
+</tr>
+
+<tr>
+<td>
+
 `core:window:allow-set-badge-count`
 
 </td>


Test patch: