-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor light and dark SVGs to make use of a color shceme
- Loading branch information
1 parent
47eb6d0
commit 11d895f
Showing
8 changed files
with
87 additions
and
64 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
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
This file was deleted.
Oops, something went wrong.
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,56 @@ | ||
// | ||
// BadgeStyle.swift | ||
// Afterpay | ||
// | ||
// Created by Adam Campbell on 5/8/20. | ||
// Copyright © 2020 Afterpay. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum ColorScheme { | ||
case `static`(ColorPalette) | ||
case dynamic(lightPalette: ColorPalette, darkPalette: ColorPalette) | ||
|
||
var lightPalette: ColorPalette { | ||
switch self { | ||
case .static(let palette): | ||
return palette | ||
case .dynamic(let lightPalette, _): | ||
return lightPalette | ||
} | ||
} | ||
|
||
var darkPalette: ColorPalette { | ||
switch self { | ||
case .static(let palette): | ||
return palette | ||
case .dynamic(_, let darkPalette): | ||
return darkPalette | ||
} | ||
} | ||
|
||
var badgeSVGPair: SVGPair { | ||
let svg: (ColorPalette) -> SVG = { palette in | ||
switch palette { | ||
case .blackOnMint: | ||
return .badgeBlackOnMint | ||
case .mintOnBlack: | ||
return .badgeMintOnBlack | ||
case .whiteOnBlack: | ||
return .badgeWhiteOnBlack | ||
case .blackOnWhite: | ||
return .badgeBlackOnWhite | ||
} | ||
} | ||
|
||
return SVGPair(lightSVG: svg(lightPalette), darkSVG: svg(darkPalette)) | ||
} | ||
} | ||
|
||
public enum ColorPalette { | ||
case blackOnMint | ||
case mintOnBlack | ||
case whiteOnBlack | ||
case blackOnWhite | ||
} |
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