Skip to content

Commit

Permalink
[meetups] - Creating init for Color that takes in RGB values - RAG
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard-Gist committed Oct 7, 2021
1 parent 53e6c95 commit 34d7140
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ExampleApps/SwiftUIExample/Views/Design/Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extension Color {
}

static var card: Color {
Color(red: 86 / 255, green: 86 / 255, blue: 118 / 255)
Color(rgbRed: 86, rgbGreen: 86, rgbBlue: 255)
.opacity(0.8)
}

Expand All @@ -32,10 +32,15 @@ extension Color {
}

private static var primaryColor: Color {
Color(red: 0 / 255, green: 134 / 255, blue: 234 / 255)
Color(rgbRed: 0, rgbGreen: 134, rgbBlue: 234)
}

static var divider: Color {
white.opacity(0.5)
}

/// Creates a `Color` using RGB values.
init(rgbRed: UInt8, rgbGreen: UInt8, rgbBlue: UInt8) {
self.init(red: Double(rgbRed) / 255, green: Double(rgbGreen) / 255, blue: Double(rgbBlue) / 255)
}
}

0 comments on commit 34d7140

Please sign in to comment.