-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Colors/NewTokens#263] Added Basic and Accent tokens
- Loading branch information
1 parent
d91f7f0
commit bdc67cc
Showing
41 changed files
with
836 additions
and
181 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
17 changes: 17 additions & 0 deletions
17
core/Sources/Theming/Content/Colors/Content/Accent/ColorsAccent.swift
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,17 @@ | ||
// | ||
// ColorsAccent.swift | ||
// Spark | ||
// | ||
// Created by louis.borlee on 01/08/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
// sourcery: AutoMockable | ||
public protocol ColorsAccent { | ||
var accent: any ColorToken { get } | ||
var onAccent: any ColorToken { get } | ||
var accentVariant: any ColorToken { get } | ||
var onAccentVariant: any ColorToken { get } | ||
var accentContainer: any ColorToken { get } | ||
var onAccentContainer: any ColorToken { get } | ||
} |
35 changes: 35 additions & 0 deletions
35
core/Sources/Theming/Content/Colors/Content/Accent/ColorsAccentDefault.swift
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,35 @@ | ||
// | ||
// ColorsAccentDefault.swift | ||
// SparkCore | ||
// | ||
// Created by louis.borlee on 01/08/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
public struct ColorsAccentDefault: ColorsAccent { | ||
|
||
// MARK: - Properties | ||
|
||
public let accent: any ColorToken | ||
public let onAccent: any ColorToken | ||
public let accentVariant: any ColorToken | ||
public let onAccentVariant: any ColorToken | ||
public let accentContainer: any ColorToken | ||
public let onAccentContainer: any ColorToken | ||
|
||
// MARK: - Init | ||
|
||
public init(accent: any ColorToken, | ||
onAccent: any ColorToken, | ||
accentVariant: any ColorToken, | ||
onAccentVariant: any ColorToken, | ||
accentContainer: any ColorToken, | ||
onAccentContainer: any ColorToken) { | ||
self.accent = accent | ||
self.onAccent = onAccent | ||
self.accentVariant = accentVariant | ||
self.onAccentVariant = onAccentVariant | ||
self.accentContainer = accentContainer | ||
self.onAccentContainer = onAccentContainer | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...rces/Theming/Content/Colors/Content/Accent/ColorsAccentGeneratedMock+ExtensionTests.swift
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,29 @@ | ||
// | ||
// ColorsAccentGeneratedMock+ExtensionTests.swift | ||
// SparkCore | ||
// | ||
// Created by robin.lemaire on 11/04/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
@testable import SparkCore | ||
|
||
extension ColorsAccentGeneratedMock { | ||
|
||
// MARK: - Methods | ||
|
||
static func mocked() -> ColorsAccentGeneratedMock { | ||
let mock = ColorsAccentGeneratedMock() | ||
|
||
mock.underlyingAccent = ColorTokenGeneratedMock.random() | ||
mock.underlyingOnAccent = ColorTokenGeneratedMock.random() | ||
|
||
mock.underlyingAccentVariant = ColorTokenGeneratedMock.random() | ||
mock.underlyingOnAccentVariant = ColorTokenGeneratedMock.random() | ||
|
||
mock.underlyingAccentContainer = ColorTokenGeneratedMock.random() | ||
mock.underlyingOnAccentContainer = ColorTokenGeneratedMock.random() | ||
|
||
return mock | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
core/Sources/Theming/Content/Colors/Content/Basic/ColorsBasic.swift
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,15 @@ | ||
// | ||
// ColorsBasic.swift | ||
// Spark | ||
// | ||
// Created by louis.borlee on 01/08/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
// sourcery: AutoMockable | ||
public protocol ColorsBasic { | ||
var basic: any ColorToken { get } | ||
var onBasic: any ColorToken { get } | ||
var basicContainer: any ColorToken { get } | ||
var onBasicContainer: any ColorToken { get } | ||
} |
29 changes: 29 additions & 0 deletions
29
core/Sources/Theming/Content/Colors/Content/Basic/ColorsBasicDefault.swift
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,29 @@ | ||
// | ||
// ColorsBasicDefault.swift | ||
// SparkCore | ||
// | ||
// Created by louis.borlee on 01/08/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
public struct ColorsBasicDefault: ColorsBasic { | ||
|
||
// MARK: - Properties | ||
|
||
public let basic: any ColorToken | ||
public let onBasic: any ColorToken | ||
public let basicContainer: any ColorToken | ||
public let onBasicContainer: any ColorToken | ||
|
||
// MARK: - Init | ||
|
||
public init(basic: any ColorToken, | ||
onBasic: any ColorToken, | ||
basicContainer: any ColorToken, | ||
onBasicContainer: any ColorToken) { | ||
self.basic = basic | ||
self.onBasic = onBasic | ||
self.basicContainer = basicContainer | ||
self.onBasicContainer = onBasicContainer | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ources/Theming/Content/Colors/Content/Basic/ColorsBasicGeneratedMock+ExtensionTests.swift
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,26 @@ | ||
// | ||
// ColorsBasicGeneratedMock+ExtensionTests.swift | ||
// SparkCore | ||
// | ||
// Created by robin.lemaire on 11/04/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
@testable import SparkCore | ||
|
||
extension ColorsBasicGeneratedMock { | ||
|
||
// MARK: - Methods | ||
|
||
static func mocked() -> ColorsBasicGeneratedMock { | ||
let mock = ColorsBasicGeneratedMock() | ||
|
||
mock.underlyingBasic = ColorTokenGeneratedMock.random() | ||
mock.underlyingOnBasic = ColorTokenGeneratedMock.random() | ||
|
||
mock.underlyingBasicContainer = ColorTokenGeneratedMock.random() | ||
mock.underlyingOnBasicContainer = ColorTokenGeneratedMock.random() | ||
|
||
return mock | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
spark/Demo/Classes/View/Theme/Color/Sections/ViewModel/ColorSectionAccentViewModel.swift
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,33 @@ | ||
// | ||
// ColorSectionAccentViewModel.swift | ||
// SparkDemo | ||
// | ||
// Created by louis.borlee on 01/08/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
import SparkCore | ||
|
||
struct ColorSectionAccentViewModel: ColorSectionViewModelable { | ||
|
||
// MARK: - Properties | ||
|
||
let name: String | ||
let itemViewModels: [[ColorItemViewModel]] | ||
|
||
// MARK: - Initialization | ||
|
||
init(color: ColorsAccent) { | ||
self.name = "accent" | ||
self.itemViewModels = [ | ||
[ | ||
.init(name: "accent", colorToken: color.accent), | ||
.init(name: "onAccent", colorToken: color.onAccent), | ||
.init(name: "accentVariant", colorToken: color.accentVariant), | ||
.init(name: "onAccentVariant", colorToken: color.onAccentVariant), | ||
.init(name: "accentContainer", colorToken: color.accentContainer), | ||
.init(name: "onAccentContainer", colorToken: color.onAccentContainer) | ||
] | ||
] | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
spark/Demo/Classes/View/Theme/Color/Sections/ViewModel/ColorSectionBasicViewModel.swift
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,31 @@ | ||
// | ||
// ColorSectionBasicViewModel.swift | ||
// SparkDemo | ||
// | ||
// Created by louis.borlee on 01/08/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
import SparkCore | ||
|
||
struct ColorSectionBasicViewModel: ColorSectionViewModelable { | ||
|
||
// MARK: - Properties | ||
|
||
let name: String | ||
let itemViewModels: [[ColorItemViewModel]] | ||
|
||
// MARK: - Initialization | ||
|
||
init(color: ColorsBasic) { | ||
self.name = "basic" | ||
self.itemViewModels = [ | ||
[ | ||
.init(name: "basic", colorToken: color.basic), | ||
.init(name: "onBasic", colorToken: color.onBasic), | ||
.init(name: "basicContainer", colorToken: color.basicContainer), | ||
.init(name: "onBasicContainer", colorToken: color.onBasicContainer) | ||
] | ||
] | ||
} | ||
} |
File renamed without changes.
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
38 changes: 38 additions & 0 deletions
38
spark/Sources/Resources/Colors.xcassets/Accent/accent.colorset/Contents.json
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,38 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0xFF", | ||
"green" : "0x99", | ||
"red" : "0xCC" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0xFF", | ||
"green" : "0x99", | ||
"red" : "0xCC" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
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
Oops, something went wrong.