Skip to content

Commit

Permalink
fix: 主题配置支持页面指示器颜色 (#53)
Browse files Browse the repository at this point in the history
Co-authored-by: qwertyyb <[email protected]>
  • Loading branch information
qwertyyb and qwertyyb authored Mar 23, 2022
1 parent dbf01c8 commit dc9fbed
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 46 deletions.
21 changes: 0 additions & 21 deletions Fire/Assets.xcassets/arrowDownOff.imageset/Contents.json

This file was deleted.

Binary file not shown.
21 changes: 0 additions & 21 deletions Fire/Assets.xcassets/arrowUpOff.imageset/Contents.json

This file was deleted.

Binary file not shown.
20 changes: 16 additions & 4 deletions Fire/CandidatesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ struct CandidatesView: View {
var _indicator: some View {
if direction == CandidatesDirection.horizontal {
return AnyView(VStack(spacing: 0) {
Image(hasPrev ? "arrowUp" : "arrowUpOff")
Image("arrowUp")
.renderingMode(.template)
.resizable()
.frame(width: 10, height: 10, alignment: .center)
.onTapGesture {
Expand All @@ -101,7 +102,12 @@ struct CandidatesView: View {
object: nil
)
}
Image(hasNext ? "arrowDown" : "arrowDownOff")
.foregroundColor(Color(hasPrev
? themeConfig[colorScheme].pageIndicatorColor
: themeConfig[colorScheme].pageIndicatorDisabledColor
))
Image("arrowDown")
.renderingMode(.template)
.resizable()
.frame(width: 10, height: 10, alignment: .center)
.onTapGesture {
Expand All @@ -112,10 +118,15 @@ struct CandidatesView: View {
object: nil
)
}
.foregroundColor(Color(hasNext
? themeConfig[colorScheme].pageIndicatorColor
: themeConfig[colorScheme].pageIndicatorDisabledColor
))
})
}
return AnyView(HStack(spacing: 4) {
Image(hasPrev ? "arrowUp" : "arrowUpOff")
Image("arrowUp")
.renderingMode(.template)
.resizable()
.frame(width: 10, height: 10, alignment: .center)
.rotationEffect(Angle(degrees: -90), anchor: .center)
Expand All @@ -126,7 +137,8 @@ struct CandidatesView: View {
object: nil
)
}
Image(hasNext ? "arrowDown" : "arrowDownOff")
Image("arrowDown")
.renderingMode(.template)
.resizable()
.frame(width: 10, height: 10, alignment: .center)
.rotationEffect(Angle(degrees: -90), anchor: .center)
Expand Down
9 changes: 9 additions & 0 deletions Fire/Theme/ThemeConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ struct ApperanceThemeConfig: Codable {
let selectedIndexColor: ColorData
let selectedTextColor: ColorData
let selectedCodeColor: ColorData

// 页面指示器颜色
let pageIndicatorColor: ColorData
// 页面指示器置灰色
let pageIndicatorDisabledColor: ColorData

let fontName: String
let fontSize: Float
Expand Down Expand Up @@ -94,6 +99,8 @@ let defaultThemeConfig = ThemeConfig(
selectedIndexColor: ColorData(red: 0.863, green: 0.078, blue: 0.235, opacity: 1),
selectedTextColor: ColorData(red: 0.863, green: 0.078, blue: 0.235, opacity: 1),
selectedCodeColor: ColorData(red: 0.863, green: 0.078, blue: 0.235, opacity: 0.8),
pageIndicatorColor: ColorData(red: 0.863, green: 0.078, blue: 0.235, opacity: 1),
pageIndicatorDisabledColor: ColorData(red: 0.863, green: 0.078, blue: 0.235, opacity: 0.4),
fontName: "system",
fontSize: 20),
dark: ApperanceThemeConfig(
Expand All @@ -112,6 +119,8 @@ let defaultThemeConfig = ThemeConfig(
selectedIndexColor: ColorData(red: 0.863, green: 0.078, blue: 0.235, opacity: 1),
selectedTextColor: ColorData(red: 0.863, green: 0.078, blue: 0.235, opacity: 1),
selectedCodeColor: ColorData(red: 0.863, green: 0.078, blue: 0.235, opacity: 0.8),
pageIndicatorColor: ColorData(red: 0.863, green: 0.078, blue: 0.235, opacity: 1),
pageIndicatorDisabledColor: ColorData(red: 0.863, green: 0.078, blue: 0.235, opacity: 0.4),
fontName: "system",
fontSize: 20
)
Expand Down

0 comments on commit dc9fbed

Please sign in to comment.