From 59fa136891ca6f1f7083790e044c2ccaed3e0bb9 Mon Sep 17 00:00:00 2001 From: natlibfi-ptalosel <117168919+natlibfi-ptalosel@users.noreply.github.com> Date: Fri, 29 Nov 2024 18:05:44 +0200 Subject: [PATCH 1/2] EKIRJASTO-102 Configure new color for segmented control in book catalog --- .../TPPConfiguration+Ekirjasto.swift | 9 +++++ .../Contents.json | 38 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Palace/EkirjastoConfig/Colors.xcassets/ColorEkirjastoFilterButtonBackgroundNormal.colorset/Contents.json diff --git a/Palace/AppInfrastructure/TPPConfiguration+Ekirjasto.swift b/Palace/AppInfrastructure/TPPConfiguration+Ekirjasto.swift index 881d9c40..ee4b7025 100644 --- a/Palace/AppInfrastructure/TPPConfiguration+Ekirjasto.swift +++ b/Palace/AppInfrastructure/TPPConfiguration+Ekirjasto.swift @@ -174,4 +174,13 @@ extension TPPConfiguration { return .lightGray } } + + @objc static func catalogSegmentedControlBackgroundColorNormal() -> UIColor { + if #available(iOS 13, *) { + return UIColor(named: "ColorEkirjastoFilterButtonBackgroundNormal")! + } else { + return .lightGray + } + } + } diff --git a/Palace/EkirjastoConfig/Colors.xcassets/ColorEkirjastoFilterButtonBackgroundNormal.colorset/Contents.json b/Palace/EkirjastoConfig/Colors.xcassets/ColorEkirjastoFilterButtonBackgroundNormal.colorset/Contents.json new file mode 100644 index 00000000..d0079ce0 --- /dev/null +++ b/Palace/EkirjastoConfig/Colors.xcassets/ColorEkirjastoFilterButtonBackgroundNormal.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xC6", + "green" : "0xC6", + "red" : "0xC6" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x12", + "green" : "0x12", + "red" : "0x12" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} From 0fce1a3309f251b2e0f5056e4998a2e6af63fc8b Mon Sep 17 00:00:00 2001 From: natlibfi-ptalosel <117168919+natlibfi-ptalosel@users.noreply.github.com> Date: Fri, 29 Nov 2024 18:09:35 +0200 Subject: [PATCH 2/2] EKIRJASTO-102 Update the background color used for normal segments --- Palace/Views/TPPEntryPointView.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Palace/Views/TPPEntryPointView.swift b/Palace/Views/TPPEntryPointView.swift index b5e6ffbb..ab0b74eb 100644 --- a/Palace/Views/TPPEntryPointView.swift +++ b/Palace/Views/TPPEntryPointView.swift @@ -45,6 +45,14 @@ final class TPPEntryPointView: UIView { } let segmentedControl = UISegmentedControl(items: titles) + + // Set style for the filter button group in top of the book catalog in "Browse books" view. + // Segmented control button can be in two states + // - selected: button is currently selected + // - normal: button is not selected + // Use special darker background color for the buttons that are in normal state to add more contrast. + segmentedControl.backgroundColor = TPPConfiguration.catalogSegmentedControlBackgroundColorNormal() + setupSubviews(segmentedControl) isHidden = false; }