Skip to content

Commit

Permalink
Color brightness sample
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaTesser committed Dec 20, 2024
1 parent bb6dd38 commit 6eb3490
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
Binary file not shown.
6 changes: 6 additions & 0 deletions SwiftUIPlayground/Samples.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,10 @@ public let samples: [String: AnyView] = [
"Progress Indicator Arc": AnyView(ProgressIndicatorArcSample()),
]
)),
"View": AnyView(SamplesList(
title: "View", samples:
[
"Color Brightess": AnyView(ColorBrightnessSample()),
]
)),
]
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct BackslashStack: Layout {
return combinedSize
}

func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache _: inout ()) {
func placeSubviews(in bounds: CGRect, proposal _: ProposedViewSize, subviews: Subviews, cache _: inout ()) {
let subviewSizes = subviews.map { proxy in
proxy.sizeThatFits(.unspecified)
}
Expand Down
23 changes: 23 additions & 0 deletions SwiftUIPlayground/Samples/View/ColorBrightnessSample.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// ColorBrightnessSample.swift
// SwiftUIPlayground
//
// Created by Taha Tesser on 20.12.2024.
//

import SwiftUI

struct ColorBrightnessSample: View {
var body: some View {
ForEach(0 ..< 8) { num in
Color.purple
.brightness(Double(num) * -0.1)
.clipShape(RoundedRectangle(cornerRadius: 16))
}
.padding(.horizontal)
}
}

#Preview {
ColorBrightnessSample()
}

0 comments on commit 6eb3490

Please sign in to comment.