This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
) This also shifts old colors to be "Legacy". Unfortunately we can not use the legacy colors that exist in the new design system because they don't match up correctly especially in dark mode. These colours can be revisited when we adjust the browser colors.
- Loading branch information
1 parent
272dffa
commit 99b85a8
Showing
60 changed files
with
2,471 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2023 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
import Foundation | ||
import SwiftUI | ||
import UIKit | ||
|
||
extension Color { | ||
/// Initialize a `Color` with a color resource. | ||
public init(braveSystemName resource: FigmaColorResource) { | ||
self.init(resource.name, bundle: resource.bundle) | ||
} | ||
} | ||
|
||
extension UIColor { | ||
/// Initialize a `UIColor` with a color resource. | ||
public convenience init(braveSystemName resource: FigmaColorResource) { | ||
self.init(named: resource.name, in: resource.bundle, compatibleWith: nil)! | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2023 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
import Foundation | ||
import SwiftUI | ||
import UIKit | ||
|
||
extension Gradient { | ||
/// Create a SwiftUI Gradient from a Brave design system gradient | ||
init(braveSystemName gradient: FigmaGradient) { | ||
self.init( | ||
stops: gradient.stops.map { stop in | ||
.init(color: Color(stop.color), location: CGFloat(stop.position)) | ||
} | ||
) | ||
} | ||
} | ||
|
||
extension LinearGradient { | ||
/// Create a SwiftUI LinearGradient from a Brave design system gradient | ||
public init(braveSystemName gradient: FigmaGradient) { | ||
assert(gradient.type == .axial, "Attempting to create a LinearGradient with a non-linear Brave defined gradient") | ||
self.init( | ||
gradient: Gradient(braveSystemName: gradient), | ||
startPoint: .init(x: gradient.startPoint.x, y: gradient.startPoint.y), | ||
endPoint: .init(x: gradient.endPoint.x, y: gradient.endPoint.y) | ||
) | ||
} | ||
} | ||
|
||
extension GradientView { | ||
/// Create a GradientView that will render a Brave design system gradient | ||
public convenience init(braveSystemName gradient: FigmaGradient) { | ||
self.init( | ||
colors: gradient.stops.map(\.color), | ||
positions: gradient.stops.map({ CGFloat($0.position) }), | ||
startPoint: gradient.startPoint, | ||
endPoint: gradient.endPoint | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.