Skip to content

Commit

Permalink
docs: update examples and macos NSVisualEffectMaterial
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Apr 15, 2022
1 parent fbab52b commit e3e2cc7
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .changes/update-macos-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"window-vibrancy": patch
---

Update examples and documentation about macOS `NSVisualEffectMaterial`.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Make your windows vibrant.
use window_vibrancy::{apply_blur, apply_vibrancy, NSVisualEffectMaterial};

#[cfg(target_os = "macos")]
apply_vibrancy(&window, NSVisualEffectMaterial::AppearanceBased).expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");
apply_vibrancy(&window, NSVisualEffectMaterial::WindowBackground).expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");

#[cfg(target_os = "windows")]
apply_blur(&window, Some((18, 18, 18, 125))).expect("Unsupported platform! 'apply_blur' is only supported on Windows");
Expand Down
2 changes: 1 addition & 1 deletion examples/tao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() {
.expect("Unsupported platform! 'apply_blur' is only supported on Windows");

#[cfg(target_os = "macos")]
let _ = apply_vibrancy(&window, NSVisualEffectMaterial::AppearanceBased)
let _ = apply_vibrancy(&window, NSVisualEffectMaterial::WindowBackground)
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");

window.set_title("A fantastic window!");
Expand Down
2 changes: 1 addition & 1 deletion examples/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() {
.expect("Unsupported platform! 'apply_blur' is only supported on Windows");

#[cfg(target_os = "macos")]
let _ = apply_vibrancy(&window, NSVisualEffectMaterial::AppearanceBased)
let _ = apply_vibrancy(&window, NSVisualEffectMaterial::WindowBackground)
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");

window.set_title("A fantastic window!");
Expand Down
58 changes: 36 additions & 22 deletions src/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,46 @@ pub enum NSVisualEffectMaterial {
since = "macOS 10.14",
note = "A default material appropriate for the view's effectiveAppearance. You should instead choose an appropriate semantic material."
)]
AppearanceBased = 0, // Default, Deprecated macOS 10.10–10.14
AppearanceBased = 0,
#[deprecated(since = "macOS 10.14", note = "Use a semantic material instead.")]
Light = 1, // Deprecated macOS 10.10–10.14
Light = 1,
#[deprecated(since = "macOS 10.14", note = "Use a semantic material instead.")]
Dark = 2, // Deprecated macOS 10.10–10.14
Dark = 2,
#[deprecated(since = "macOS 10.14", note = "Use a semantic material instead.")]
MediumLight = 8, // Deprecated macOS 10.11–10.14
MediumLight = 8,
#[deprecated(since = "macOS 10.14", note = "Use a semantic material instead.")]
UltraDark = 9, // Deprecated macOS 10.11–10.14

Titlebar = 3, // macOS 10.10+
Selection = 4, // macOS 10.10+

Menu = 5, // macOS 10.11+
Popover = 6, // macOS 10.11+
Sidebar = 7, // macOS 10.11+

HeaderView = 10, // macOS 10.14+
Sheet = 11, // macOS 10.14+
WindowBackground = 12, // macOS 10.14+
HudWindow = 13, // macOS 10.14+
FullScreenUI = 15, // macOS 10.14+
Tooltip = 17, // macOS 10.14+
ContentBackground = 18, // macOS 10.14+
UnderWindowBackground = 21, // macOS 10.14+
UnderPageBackground = 22, // macOS 10.14+
UltraDark = 9,

/// macOS 10.10+
Titlebar = 3,
/// macOS 10.10+
Selection = 4,

/// macOS 10.11+
Menu = 5,
/// macOS 10.11+
Popover = 6,
/// macOS 10.11+
Sidebar = 7,

/// macOS 10.14+
HeaderView = 10,
/// macOS 10.14+
Sheet = 11,
/// macOS 10.14+
WindowBackground = 12,
/// macOS 10.14+
HudWindow = 13,
/// macOS 10.14+
FullScreenUI = 15,
/// macOS 10.14+
Tooltip = 17,
/// macOS 10.14+
ContentBackground = 18,
/// macOS 10.14+
UnderWindowBackground = 21,
/// macOS 10.14+
UnderPageBackground = 22,
}

#[cfg(target_os = "macos")]
Expand Down

0 comments on commit e3e2cc7

Please sign in to comment.