Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daprice/blurhashviews
Decode BlurHash strings to SwiftUI MeshGradient or Color with various customization options.
https://github.com/daprice/blurhashviews
blurhash ios18 macos15 meshgradient swift-package swiftui
Last synced: 6 days ago
JSON representation
Decode BlurHash strings to SwiftUI MeshGradient or Color with various customization options.
- Host: GitHub
- URL: https://github.com/daprice/blurhashviews
- Owner: daprice
- License: mit
- Created: 2024-06-13T23:40:07.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-30T22:41:39.000Z (6 months ago)
- Last Synced: 2025-01-08T23:13:44.905Z (13 days ago)
- Topics: blurhash, ios18, macos15, meshgradient, swift-package, swiftui
- Language: Swift
- Homepage:
- Size: 41 KB
- Stars: 76
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ``BlurHashViews``
Decode BlurHash strings to SwiftUI `Color` or `MeshGradient` with various customization options.
## Overview
BlurHash ([blurha.sh](https://blurha.sh)) is a way of representing placeholders for images using a compact string representation. [Existing implementations](https://github.com/woltapp/blurhash) focus on decoding a BlurHash to a small image that can be used as a placeholder. This package allows you to create native SwiftUI views directly from BlurHash encoded strings.
Open `Sources/BlurHashViews/Previews.swift` in Xcode 16 for an interactive SwiftUI preview with example views of BlurHashes from social media sites, allowing you to try different customization options for how they are displayed, including:
- Change the `punch` argument to control the contrast between colors in the BlurHash.
- Decode the BlurHash at different detail levels for more or less complex mesh gradients.
- Adjust the smoothing and color space options provided by SwiftUI MeshGradient.There's also a decoder that returns the mesh points and colors so you can customize it in code however you want – animate the points to make it swirl, find the most intense color in the image, make custom transitions… whatever you can dream up!
### Compatibility
- iOS/tvOS 13+, macOS 10.15+, watchOS 6+ – Create a SwiftUI `Color` from the average of a BlurHash.
- iOS/tvOS 18+, macOS 15+, watchOS 11+ – Create a `MeshGradient` from the colors in a BlurHash.For previous operating systems, the [original BlurHash library](https://github.com/woltapp/blurhash/tree/master/Swift) provides a UIImage-based decoding implementation.