Skip to content

Commit

Permalink
Improving interface for accessibility Increase Contrast - Closes #34
Browse files Browse the repository at this point in the history
  • Loading branch information
DamascenoRafael committed Mar 18, 2023
1 parent e5e190c commit 769be22
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "83",
"green" : "83",
"red" : "83"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "180",
"green" : "180",
"red" : "180"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,46 @@
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "contrast",
"value" : "high"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xED",
"green" : "0xED",
"red" : "0xED"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
},
{
"appearance" : "contrast",
"value" : "high"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "51",
"green" : "51",
"red" : "51"
}
},
"idiom" : "universal"
}
],
"info" : {
Expand Down
1 change: 1 addition & 0 deletions reminders-menu-bar/Resources/RmbColorKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ enum RmbColorKey: String {
case buttonHover
case backgroundTheme
case textFieldBackground // textFieldBackgroundTransparent
case borderContrast

private var transparencyPostfix: String { "Transparent" }

Expand Down
18 changes: 18 additions & 0 deletions reminders-menu-bar/Views/FormNewReminderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct FormNewReminderView: View {
.background(Color.rmbColor(for: .textFieldBackground, and: colorSchemeContrast))
.cornerRadius(8)
.textFieldStyle(PlainTextFieldStyle())
.modifier(ContrastBorderOverlay())
.overlay(
Image(systemName: "plus.circle.fill")
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
Expand Down Expand Up @@ -62,6 +63,7 @@ struct FormNewReminderView: View {
.padding(.trailing, 2)
.background(Color(userPreferences.calendarForSaving?.color ?? .white))
.cornerRadius(8)
.modifier(ContrastBorderOverlay())
.help(rmbLocalized(.newReminderCalendarSelectionToSaveHelp))
}
}
Expand Down Expand Up @@ -240,6 +242,22 @@ func reminderRemindDateTimeOptionView(date: Binding<Date>,
}
}

struct ContrastBorderOverlay: ViewModifier {
@Environment(\.colorSchemeContrast) private var colorSchemeContrast
private var isEnabled: Bool { colorSchemeContrast == .increased }

func body(content: Content) -> some View {
return content
.overlay(
isEnabled
? RoundedRectangle(cornerRadius: 8)
.strokeBorder(style: StrokeStyle(lineWidth: 1))
.foregroundColor(Color.rmbColor(for: .borderContrast, and: colorSchemeContrast))
: nil
)
}
}

struct RemindDateTimeCapsuleStyle: ViewModifier {
func body(content: Content) -> some View {
return content
Expand Down

0 comments on commit 769be22

Please sign in to comment.