Skip to content

DimitarNestorov/MacBezel

Repository files navigation

MacBezel

Mimic the macOS bezel

Screenshot

Installation

Add the following to your dependencies in Package.swift:

.package(url: "https://github.com/dimitarnestorov/MacBezel", .upToNextMinor(from: "0.1.0")),

Usage

import MacBezel

Bezel.show(NSImage(named: "done")!, options: [.text: "Done"])

Using SF Symbols

import MacBezel

let image = NSImage(systemSymbolName: "lock", accessibilityDescription: nil)!
    .withSymbolConfiguration(.init(pointSize: 500, weight: .medium, scale: .large))!
    .resizeForBezel()
Bezel.show(image, options: [.text: "Locked"])

Icon spec

Icons should be 174 x 174 points. Icons that will be displayed with the text option should position their content in a 115 x 115 points padded 29.5 points from the left and 43 points from the bottom.

For best results use a vector image and set "Render As" to "Template Image".

If you want to use an SF Symbol or another icon library MacBezel comes with an extension to NSImage:

/// Returns a new NSImage appropriately resized for MacBezel
func resizeForBezel() -> NSImage

Playground

Open with Xcode (switch the destination to "My Mac")