cruisediary
Pastel
Swift

๐ŸŽจ Gradient animation effect like Instagram

Last updated Jul 6, 2026
3.5k
Stars
186
Forks
16
Issues
+1
Stars/day
Attention Score
94
Language breakdown
Swift 96.2%
Ruby 2.9%
Objective-C 0.9%
โ–ธ Files click to expand
README

Pastel

๐ŸŽจ Gradient animation effect like Instagram

Swift Version License Platform SPM compatible

pastel</em>01.gif pastel</em>02.gif pastel</em>03.gif

Requirements

  • iOS 16.0+
  • Swift 5.9+
  • Xcode 15+

Installation

Swift Package Manager

Add Pastel to your Package.swift:

dependencies: [
    .package(url: "https://github.com/cruisediary/Pastel.git", from: "1.0.0")
]

Or in Xcode: File โ†’ Add Package Dependencies and enter the repository URL.

CocoaPods

pod 'Pastel', '~> 1.0.0'

Usage

SwiftUI

Animated gradient background (preset)

import SwiftUI
import Pastel

struct ContentView: View { var body: some View { Text("Hello") .pastelBackground(.instagram) } }

Animated gradient background (custom colors)

Text("Hello")
    .pastelBackground(colors: [
        UIColor(red: 156/255, green: 39/255, blue: 176/255, alpha: 1),
        UIColor(red: 255/255, green: 64/255, blue: 129/255, alpha: 1),
        UIColor(red: 32/255, green: 76/255, blue: 255/255, alpha: 1)
    ], duration: 3.0)

Animated gradient view

PastelGradientView(gradient: .sunset, duration: 4.0)
    .ignoresSafeArea()

Animated gradient text

PastelText("Pastel", font: .largeTitle, gradient: .instagram)

Shared state (coordinate multiple views)

let state = PastelAnimationState(
    colors: [.purple, .pink, .blue],
    duration: 3.0,
    timingCurve: .easeInOut,
    repeatBehavior: .count(5),
    autoreverses: true
)

PastelGradientView(state: state) PastelText("Hello", state: state)

UIKit

Basic usage

override func viewDidLoad() {
    super.viewDidLoad()

let pastelView = PastelView(frame: view.bounds)

// Direction pastelView.startPastelPoint = .bottomLeft pastelView.endPastelPoint = .topRight

// Duration pastelView.animationDuration = 3.0

// Colors pastelView.setColors([ UIColor(red: 156/255, green: 39/255, blue: 176/255, alpha: 1), UIColor(red: 255/255, green: 64/255, blue: 129/255, alpha: 1), UIColor(red: 123/255, green: 31/255, blue: 162/255, alpha: 1), UIColor(red: 32/255, green: 76/255, blue: 255/255, alpha: 1), UIColor(red: 58/255, green: 255/255, blue: 217/255, alpha: 1) ])

pastelView.startAnimation() view.insertSubview(pastelView, at: 0) }

Shared state with UIKit

let state = PastelAnimationState(
    colors: [.purple, .pink, .blue],
    duration: 3.0,
    timingCurve: .easeInOut
)

let pastelView = PastelView(frame: view.bounds) pastelView.animationState = state pastelView.startAnimation() view.insertSubview(pastelView, at: 0)

๐ŸŽจ Gradient Presets

30 built-in presets available via PastelGradient.

Designed by Alexander Zaytsev โ€” https://dribbble.com/anwaltzzz

Gradient.png

Example Project

Clone the repo and open Example/Pastel.xcodeproj. No additional setup needed โ€” Pastel is linked via SPM automatically.

Author

cruz, cruzdiary@gmail.com

Thanks

Many thanks to the contributors of this project.

License

Pastel is available under the MIT license. See the LICENSE file for more info.

ยฉ 2026 GitRepoTrend ยท cruisediary/Pastel ยท Updated daily from GitHub