From 65ab5ed0f56d0470e2fa9508dd6e9af0dd0d2cc5 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Fri, 1 Sep 2023 22:13:15 -0600 Subject: [PATCH] handle iconcolor in basicui named colors only, on svg icons only and for dark model, the grayscale colors are inverted! Signed-off-by: Cody Cutrer --- .../OpenHABCore/Model/OpenHABWidget.swift | 4 +- openHAB.xcodeproj/project.pbxproj | 110 ++++++++++-------- openHAB/OpenHABSitemapViewController.swift | 15 ++- .../Resources/Assets.xcassets/Contents.json | 6 + .../aqua.colorset/Contents.json | 38 ++++++ .../black.colorset/Contents.json | 38 ++++++ .../blue.colorset/Contents.json | 38 ++++++ .../fuchsia.colorset/Contents.json | 38 ++++++ .../gold.colorset/Contents.json | 38 ++++++ .../gray.colorset/Contents.json | 38 ++++++ .../green.colorset/Contents.json | 38 ++++++ .../lime.colorset/Contents.json | 38 ++++++ .../maroon.colorset/Contents.json | 38 ++++++ .../navy.colorset/Contents.json | 38 ++++++ .../olive.colorset/Contents.json | 38 ++++++ .../orange.colorset/Contents.json | 38 ++++++ .../pink.colorset/Contents.json | 38 ++++++ .../purple.colorset/Contents.json | 38 ++++++ .../red.colorset/Contents.json | 38 ++++++ .../silver.colorset/Contents.json | 38 ++++++ .../teal.colorset/Contents.json | 38 ++++++ .../white.colorset/Contents.json | 38 ++++++ .../yellow.colorset/Contents.json | 38 ++++++ openHAB/SVGKImage+setFillColor.swift | 34 ++++++ 24 files changed, 836 insertions(+), 55 deletions(-) create mode 100644 openHAB/Resources/Assets.xcassets/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/aqua.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/black.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/blue.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/fuchsia.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/gold.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/gray.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/green.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/lime.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/maroon.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/navy.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/olive.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/orange.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/pink.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/purple.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/red.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/silver.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/teal.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/white.colorset/Contents.json create mode 100644 openHAB/Resources/Assets.xcassets/yellow.colorset/Contents.json create mode 100644 openHAB/SVGKImage+setFillColor.swift diff --git a/OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift b/OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift index 86971fb8e..a7fcaaa71 100644 --- a/OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift +++ b/OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift @@ -310,7 +310,7 @@ public extension OpenHABWidget { let refresh: Int? let height: Double? let isLeaf: Bool? - let iconColor: String? + let iconcolor: String? let labelcolor: String? let valuecolor: String? let service: String? @@ -333,7 +333,7 @@ public extension OpenHABWidget { extension OpenHABWidget.CodingData { var openHABWidget: OpenHABWidget { let mappedWidgets = widgets.map(\.openHABWidget) - return OpenHABWidget(widgetId: widgetId, label: label, icon: icon, type: type, url: url, period: period, minValue: minValue, maxValue: maxValue, step: step, refresh: refresh, height: height, isLeaf: isLeaf, iconColor: iconColor, labelColor: labelcolor, valueColor: valuecolor, service: service, state: state, text: text, legend: legend, encoding: encoding, item: item?.openHABItem, linkedPage: linkedPage, mappings: mappings, widgets: mappedWidgets, visibility: visibility, switchSupport: switchSupport, forceAsItem: forceAsItem) + return OpenHABWidget(widgetId: widgetId, label: label, icon: icon, type: type, url: url, period: period, minValue: minValue, maxValue: maxValue, step: step, refresh: refresh, height: height, isLeaf: isLeaf, iconColor: iconcolor, labelColor: labelcolor, valueColor: valuecolor, service: service, state: state, text: text, legend: legend, encoding: encoding, item: item?.openHABItem, linkedPage: linkedPage, mappings: mappings, widgets: mappedWidgets, visibility: visibility, switchSupport: switchSupport, forceAsItem: forceAsItem) } } diff --git a/openHAB.xcodeproj/project.pbxproj b/openHAB.xcodeproj/project.pbxproj index fe69ae156..07bff3b4e 100644 --- a/openHAB.xcodeproj/project.pbxproj +++ b/openHAB.xcodeproj/project.pbxproj @@ -69,6 +69,8 @@ A07EF7A02230C0A30040919F /* OpenHABClientCertificatesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A07EF79F2230C0A20040919F /* OpenHABClientCertificatesViewController.swift */; }; A3F4C3A51A49A5940019A09F /* MainLaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A3F4C3A41A49A5940019A09F /* MainLaunchScreen.xib */; }; B7D5ECE121499E55001B0EC6 /* MapViewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D5ECE021499E55001B0EC6 /* MapViewTableViewCell.swift */; }; + C32CA1882AA2D1E900F4551B /* SVGKImage+setFillColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32CA1872AA2D1E900F4551B /* SVGKImage+setFillColor.swift */; }; + C32CA18A2AA2E1E300F4551B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C32CA1892AA2E1E300F4551B /* Assets.xcassets */; }; DA0749DE23E0B5950057FA83 /* ColorPickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0749DD23E0B5950057FA83 /* ColorPickerRow.swift */; }; DA0749E023E0BF510057FA83 /* ColorSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0749DF23E0BF510057FA83 /* ColorSelection.swift */; }; DA0775192346705D0086C685 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DA0775172346705D0086C685 /* Interface.storyboard */; }; @@ -304,6 +306,8 @@ A07EF79F2230C0A20040919F /* OpenHABClientCertificatesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenHABClientCertificatesViewController.swift; sourceTree = ""; }; A3F4C3A41A49A5940019A09F /* MainLaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MainLaunchScreen.xib; path = ../MainLaunchScreen.xib; sourceTree = ""; }; B7D5ECE021499E55001B0EC6 /* MapViewTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapViewTableViewCell.swift; sourceTree = ""; }; + C32CA1872AA2D1E900F4551B /* SVGKImage+setFillColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SVGKImage+setFillColor.swift"; sourceTree = ""; }; + C32CA1892AA2E1E300F4551B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; DA0749DD23E0B5950057FA83 /* ColorPickerRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPickerRow.swift; sourceTree = ""; }; DA0749DF23E0BF510057FA83 /* ColorSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorSelection.swift; sourceTree = ""; }; DA0775152346705D0086C685 /* openHABWatch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = openHABWatch.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -583,6 +587,7 @@ children = ( 938BF9C824EFCCC000E6B52F /* Localizable.strings */, 938BF9CA24EFCCC000E6B52F /* InfoPlist.strings */, + C32CA1892AA2E1E300F4551B /* Assets.xcassets */, ); path = Resources; sourceTree = ""; @@ -964,6 +969,7 @@ 938BF9C524EFCC0700E6B52F /* UILabel+Localization.swift */, 938BF9D224EFD0B700E6B52F /* UIViewController+Localization.swift */, 935B484525342B8E00E44CF0 /* URL+Static.swift */, + C32CA1872AA2D1E900F4551B /* SVGKImage+setFillColor.swift */, ); name = Util; sourceTree = ""; @@ -1159,19 +1165,19 @@ ); mainGroup = DFB2621E18830A3600D3244D; packageReferences = ( - 937E4480270B378F00A98C26 /* XCRemoteSwiftPackageReference "Fuzi.git" */, - 937E4483270B379900A98C26 /* XCRemoteSwiftPackageReference "DeviceKit.git" */, - 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher.git" */, - 93F8061927AE615D0035A6B0 /* XCRemoteSwiftPackageReference "Alamofire.git" */, - 93F8063027AE6B940035A6B0 /* XCRemoteSwiftPackageReference "AlamofireNetworkActivityIndicator.git" */, - 93F8063327AE6C620035A6B0 /* XCRemoteSwiftPackageReference "firebase-ios-sdk.git" */, - 93F8064527AE7A050035A6B0 /* XCRemoteSwiftPackageReference "SwiftMessages.git" */, - 93F8064827AE7A2E0035A6B0 /* XCRemoteSwiftPackageReference "FlexColorPicker.git" */, - 93F8064B27AE7A4D0035A6B0 /* XCRemoteSwiftPackageReference "DynamicButton.git" */, - 93F8064E27AE7A820035A6B0 /* XCRemoteSwiftPackageReference "SideMenu.git" */, - 93F8065127AE7B580035A6B0 /* XCRemoteSwiftPackageReference "SVGKit.git" */, - 934E591C28F16E1600162004 /* XCRemoteSwiftPackageReference "SwiftFormatPlugin.git" */, - 934E591D28F16E8600162004 /* XCRemoteSwiftPackageReference "SwiftLintPlugin.git" */, + 937E4480270B378F00A98C26 /* XCRemoteSwiftPackageReference "Fuzi" */, + 937E4483270B379900A98C26 /* XCRemoteSwiftPackageReference "DeviceKit" */, + 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher" */, + 93F8061927AE615D0035A6B0 /* XCRemoteSwiftPackageReference "Alamofire" */, + 93F8063027AE6B940035A6B0 /* XCRemoteSwiftPackageReference "AlamofireNetworkActivityIndicator" */, + 93F8063327AE6C620035A6B0 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, + 93F8064527AE7A050035A6B0 /* XCRemoteSwiftPackageReference "SwiftMessages" */, + 93F8064827AE7A2E0035A6B0 /* XCRemoteSwiftPackageReference "FlexColorPicker" */, + 93F8064B27AE7A4D0035A6B0 /* XCRemoteSwiftPackageReference "DynamicButton" */, + 93F8064E27AE7A820035A6B0 /* XCRemoteSwiftPackageReference "SideMenu" */, + 93F8065127AE7B580035A6B0 /* XCRemoteSwiftPackageReference "SVGKit" */, + 934E591C28F16E1600162004 /* XCRemoteSwiftPackageReference "SwiftFormatPlugin" */, + 934E591D28F16E8600162004 /* XCRemoteSwiftPackageReference "SwiftLintPlugin" */, ); productRefGroup = DFB2622818830A3600D3244D /* Products */; projectDirPath = ""; @@ -1233,6 +1239,7 @@ 938BF9D024EFCCC000E6B52F /* Localizable.strings in Resources */, DFB2624618830A3600D3244D /* Images.xcassets in Resources */, 938BF9D124EFCCC000E6B52F /* InfoPlist.strings in Resources */, + C32CA18A2AA2E1E300F4551B /* Assets.xcassets in Resources */, 938BF9C424EFCB9F00E6B52F /* Main.storyboard in Resources */, DA817E7A234BF39B00C91824 /* CHANGELOG.md in Resources */, DA4D4DB5233F9ACB00B37E37 /* README.md in Resources */, @@ -1383,6 +1390,7 @@ DAEAA89B21E2611000267EA3 /* OpenHABNotificationsViewController.swift in Sources */, DF1B302D1CF5C667009C921C /* OpenHABNotification.swift in Sources */, 938BF9D324EFD0B700E6B52F /* UIViewController+Localization.swift in Sources */, + C32CA1882AA2D1E900F4551B /* SVGKImage+setFillColor.swift in Sources */, DF06F1F618FE7A160011E7B9 /* OpenHABSelectionTableViewController.swift in Sources */, DAA42BA821DC97E000244B2A /* NotificationTableViewCell.swift in Sources */, 6595667E28E0BE8E00E8A53B /* MulticastDelegate.swift in Sources */, @@ -1422,11 +1430,11 @@ }; 934E592128F16E9600162004 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - productRef = 934E592028F16E9600162004 /* plugin:SwiftLintPlugin */; + productRef = 934E592028F16E9600162004 /* SwiftLintPlugin */; }; 934E592328F16E9E00162004 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - productRef = 934E592228F16E9E00162004 /* plugin:SwiftFormatPlugin */; + productRef = 934E592228F16E9E00162004 /* SwiftFormatPlugin */; }; DA07753A2346705F0086C685 /* PBXTargetDependency */ = { isa = PBXTargetDependency; @@ -2106,7 +2114,7 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 934E591C28F16E1600162004 /* XCRemoteSwiftPackageReference "SwiftFormatPlugin.git" */ = { + 934E591C28F16E1600162004 /* XCRemoteSwiftPackageReference "SwiftFormatPlugin" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/weakfl/SwiftFormatPlugin.git"; requirement = { @@ -2114,7 +2122,7 @@ minimumVersion = 0.50.1; }; }; - 934E591D28F16E8600162004 /* XCRemoteSwiftPackageReference "SwiftLintPlugin.git" */ = { + 934E591D28F16E8600162004 /* XCRemoteSwiftPackageReference "SwiftLintPlugin" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/weakfl/SwiftLintPlugin.git"; requirement = { @@ -2122,7 +2130,7 @@ minimumVersion = 0.50.3; }; }; - 937E4480270B378F00A98C26 /* XCRemoteSwiftPackageReference "Fuzi.git" */ = { + 937E4480270B378F00A98C26 /* XCRemoteSwiftPackageReference "Fuzi" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/cezheng/Fuzi.git"; requirement = { @@ -2130,7 +2138,7 @@ minimumVersion = 3.0.0; }; }; - 937E4483270B379900A98C26 /* XCRemoteSwiftPackageReference "DeviceKit.git" */ = { + 937E4483270B379900A98C26 /* XCRemoteSwiftPackageReference "DeviceKit" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/devicekit/DeviceKit.git"; requirement = { @@ -2138,7 +2146,7 @@ minimumVersion = 4.0.0; }; }; - 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher.git" */ = { + 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/onevcat/Kingfisher.git"; requirement = { @@ -2146,7 +2154,7 @@ minimumVersion = 7.0.0; }; }; - 93F8061927AE615D0035A6B0 /* XCRemoteSwiftPackageReference "Alamofire.git" */ = { + 93F8061927AE615D0035A6B0 /* XCRemoteSwiftPackageReference "Alamofire" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/Alamofire/Alamofire.git"; requirement = { @@ -2154,7 +2162,7 @@ version = 5.4.4; }; }; - 93F8063027AE6B940035A6B0 /* XCRemoteSwiftPackageReference "AlamofireNetworkActivityIndicator.git" */ = { + 93F8063027AE6B940035A6B0 /* XCRemoteSwiftPackageReference "AlamofireNetworkActivityIndicator" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/Alamofire/AlamofireNetworkActivityIndicator.git"; requirement = { @@ -2162,7 +2170,7 @@ minimumVersion = 3.0.0; }; }; - 93F8063327AE6C620035A6B0 /* XCRemoteSwiftPackageReference "firebase-ios-sdk.git" */ = { + 93F8063327AE6C620035A6B0 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git"; requirement = { @@ -2170,7 +2178,7 @@ minimumVersion = 8.0.0; }; }; - 93F8064527AE7A050035A6B0 /* XCRemoteSwiftPackageReference "SwiftMessages.git" */ = { + 93F8064527AE7A050035A6B0 /* XCRemoteSwiftPackageReference "SwiftMessages" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/SwiftKickMobile/SwiftMessages.git"; requirement = { @@ -2178,7 +2186,7 @@ minimumVersion = 9.0.0; }; }; - 93F8064827AE7A2E0035A6B0 /* XCRemoteSwiftPackageReference "FlexColorPicker.git" */ = { + 93F8064827AE7A2E0035A6B0 /* XCRemoteSwiftPackageReference "FlexColorPicker" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/RastislavMirek/FlexColorPicker.git"; requirement = { @@ -2186,7 +2194,7 @@ minimumVersion = 1.0.0; }; }; - 93F8064B27AE7A4D0035A6B0 /* XCRemoteSwiftPackageReference "DynamicButton.git" */ = { + 93F8064B27AE7A4D0035A6B0 /* XCRemoteSwiftPackageReference "DynamicButton" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/yannickl/DynamicButton.git"; requirement = { @@ -2194,7 +2202,7 @@ minimumVersion = 6.0.0; }; }; - 93F8064E27AE7A820035A6B0 /* XCRemoteSwiftPackageReference "SideMenu.git" */ = { + 93F8064E27AE7A820035A6B0 /* XCRemoteSwiftPackageReference "SideMenu" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/jonkykong/SideMenu.git"; requirement = { @@ -2202,7 +2210,7 @@ minimumVersion = 6.0.0; }; }; - 93F8065127AE7B580035A6B0 /* XCRemoteSwiftPackageReference "SVGKit.git" */ = { + 93F8065127AE7B580035A6B0 /* XCRemoteSwiftPackageReference "SVGKit" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/SVGKit/SVGKit.git"; requirement = { @@ -2213,14 +2221,14 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - 934E592028F16E9600162004 /* plugin:SwiftLintPlugin */ = { + 934E592028F16E9600162004 /* SwiftLintPlugin */ = { isa = XCSwiftPackageProductDependency; - package = 934E591D28F16E8600162004 /* XCRemoteSwiftPackageReference "SwiftLintPlugin.git" */; + package = 934E591D28F16E8600162004 /* XCRemoteSwiftPackageReference "SwiftLintPlugin" */; productName = "plugin:SwiftLintPlugin"; }; - 934E592228F16E9E00162004 /* plugin:SwiftFormatPlugin */ = { + 934E592228F16E9E00162004 /* SwiftFormatPlugin */ = { isa = XCSwiftPackageProductDependency; - package = 934E591C28F16E1600162004 /* XCRemoteSwiftPackageReference "SwiftFormatPlugin.git" */; + package = 934E591C28F16E1600162004 /* XCRemoteSwiftPackageReference "SwiftFormatPlugin" */; productName = "plugin:SwiftFormatPlugin"; }; 934E592428F16EBA00162004 /* OpenHABCore */ = { @@ -2229,17 +2237,17 @@ }; 934E592628F16EBA00162004 /* Kingfisher */ = { isa = XCSwiftPackageProductDependency; - package = 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher.git" */; + package = 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher" */; productName = Kingfisher; }; 934E592828F16EBA00162004 /* DeviceKit */ = { isa = XCSwiftPackageProductDependency; - package = 937E4483270B379900A98C26 /* XCRemoteSwiftPackageReference "DeviceKit.git" */; + package = 937E4483270B379900A98C26 /* XCRemoteSwiftPackageReference "DeviceKit" */; productName = DeviceKit; }; 934E592A28F16EBA00162004 /* Alamofire */ = { isa = XCSwiftPackageProductDependency; - package = 93F8061927AE615D0035A6B0 /* XCRemoteSwiftPackageReference "Alamofire.git" */; + package = 93F8061927AE615D0035A6B0 /* XCRemoteSwiftPackageReference "Alamofire" */; productName = Alamofire; }; 937E4470270B36D000A98C26 /* OpenHABCore */ = { @@ -2252,37 +2260,37 @@ }; 937E4481270B378F00A98C26 /* Fuzi */ = { isa = XCSwiftPackageProductDependency; - package = 937E4480270B378F00A98C26 /* XCRemoteSwiftPackageReference "Fuzi.git" */; + package = 937E4480270B378F00A98C26 /* XCRemoteSwiftPackageReference "Fuzi" */; productName = Fuzi; }; 937E4484270B379900A98C26 /* DeviceKit */ = { isa = XCSwiftPackageProductDependency; - package = 937E4483270B379900A98C26 /* XCRemoteSwiftPackageReference "DeviceKit.git" */; + package = 937E4483270B379900A98C26 /* XCRemoteSwiftPackageReference "DeviceKit" */; productName = DeviceKit; }; 937E4487270B37A600A98C26 /* Kingfisher */ = { isa = XCSwiftPackageProductDependency; - package = 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher.git" */; + package = 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher" */; productName = Kingfisher; }; 937E448B270B37CA00A98C26 /* Kingfisher */ = { isa = XCSwiftPackageProductDependency; - package = 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher.git" */; + package = 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher" */; productName = Kingfisher; }; 937E448D270B37D200A98C26 /* DeviceKit */ = { isa = XCSwiftPackageProductDependency; - package = 937E4483270B379900A98C26 /* XCRemoteSwiftPackageReference "DeviceKit.git" */; + package = 937E4483270B379900A98C26 /* XCRemoteSwiftPackageReference "DeviceKit" */; productName = DeviceKit; }; 937E4491270B37FE00A98C26 /* Kingfisher */ = { isa = XCSwiftPackageProductDependency; - package = 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher.git" */; + package = 937E4486270B37A600A98C26 /* XCRemoteSwiftPackageReference "Kingfisher" */; productName = Kingfisher; }; 937E4493270B380500A98C26 /* Fuzi */ = { isa = XCSwiftPackageProductDependency; - package = 937E4480270B378F00A98C26 /* XCRemoteSwiftPackageReference "Fuzi.git" */; + package = 937E4480270B378F00A98C26 /* XCRemoteSwiftPackageReference "Fuzi" */; productName = Fuzi; }; 937E44E1270B393C00A98C26 /* OpenHABCore */ = { @@ -2291,47 +2299,47 @@ }; 93F8061A27AE615D0035A6B0 /* Alamofire */ = { isa = XCSwiftPackageProductDependency; - package = 93F8061927AE615D0035A6B0 /* XCRemoteSwiftPackageReference "Alamofire.git" */; + package = 93F8061927AE615D0035A6B0 /* XCRemoteSwiftPackageReference "Alamofire" */; productName = Alamofire; }; 93F8062E27AE63620035A6B0 /* Alamofire */ = { isa = XCSwiftPackageProductDependency; - package = 93F8061927AE615D0035A6B0 /* XCRemoteSwiftPackageReference "Alamofire.git" */; + package = 93F8061927AE615D0035A6B0 /* XCRemoteSwiftPackageReference "Alamofire" */; productName = Alamofire; }; 93F8063127AE6B940035A6B0 /* AlamofireNetworkActivityIndicator */ = { isa = XCSwiftPackageProductDependency; - package = 93F8063027AE6B940035A6B0 /* XCRemoteSwiftPackageReference "AlamofireNetworkActivityIndicator.git" */; + package = 93F8063027AE6B940035A6B0 /* XCRemoteSwiftPackageReference "AlamofireNetworkActivityIndicator" */; productName = AlamofireNetworkActivityIndicator; }; 93F8063427AE6C620035A6B0 /* FirebaseCrashlytics */ = { isa = XCSwiftPackageProductDependency; - package = 93F8063327AE6C620035A6B0 /* XCRemoteSwiftPackageReference "firebase-ios-sdk.git" */; + package = 93F8063327AE6C620035A6B0 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; productName = FirebaseCrashlytics; }; 93F8064627AE7A050035A6B0 /* SwiftMessages */ = { isa = XCSwiftPackageProductDependency; - package = 93F8064527AE7A050035A6B0 /* XCRemoteSwiftPackageReference "SwiftMessages.git" */; + package = 93F8064527AE7A050035A6B0 /* XCRemoteSwiftPackageReference "SwiftMessages" */; productName = SwiftMessages; }; 93F8064927AE7A2E0035A6B0 /* FlexColorPicker */ = { isa = XCSwiftPackageProductDependency; - package = 93F8064827AE7A2E0035A6B0 /* XCRemoteSwiftPackageReference "FlexColorPicker.git" */; + package = 93F8064827AE7A2E0035A6B0 /* XCRemoteSwiftPackageReference "FlexColorPicker" */; productName = FlexColorPicker; }; 93F8064C27AE7A4D0035A6B0 /* DynamicButton */ = { isa = XCSwiftPackageProductDependency; - package = 93F8064B27AE7A4D0035A6B0 /* XCRemoteSwiftPackageReference "DynamicButton.git" */; + package = 93F8064B27AE7A4D0035A6B0 /* XCRemoteSwiftPackageReference "DynamicButton" */; productName = DynamicButton; }; 93F8064F27AE7A830035A6B0 /* SideMenu */ = { isa = XCSwiftPackageProductDependency; - package = 93F8064E27AE7A820035A6B0 /* XCRemoteSwiftPackageReference "SideMenu.git" */; + package = 93F8064E27AE7A820035A6B0 /* XCRemoteSwiftPackageReference "SideMenu" */; productName = SideMenu; }; 93F8065227AE7B580035A6B0 /* SVGKit */ = { isa = XCSwiftPackageProductDependency; - package = 93F8065127AE7B580035A6B0 /* XCRemoteSwiftPackageReference "SVGKit.git" */; + package = 93F8065127AE7B580035A6B0 /* XCRemoteSwiftPackageReference "SVGKit" */; productName = SVGKit; }; /* End XCSwiftPackageProductDependency section */ diff --git a/openHAB/OpenHABSitemapViewController.swift b/openHAB/OpenHABSitemapViewController.swift index 019f6b272..5041d0d23 100644 --- a/openHAB/OpenHABSitemapViewController.swift +++ b/openHAB/OpenHABSitemapViewController.swift @@ -29,6 +29,7 @@ struct OpenHABImageProcessor: ImageProcessor { // `identifier` should be the same for processors with the same properties/functionality // It will be used when storing and retrieving the image to/from cache. let identifier = "org.openhab.svgprocessor" + let iconColor: String? // Convert input data/image to target image and return it. func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? { @@ -46,6 +47,11 @@ struct OpenHABImageProcessor: ImageProcessor { let svgkSourceNSData = SVGKSourceNSData.source(from: data, urlForRelativeLinks: nil) let parseResults = SVGKParser.parseSource(usingDefaultSVGKParser: svgkSourceNSData) if parseResults?.parsedDocument != nil, let image = SVGKImage(parsedSVG: parseResults, from: svgkSourceNSData), image.hasSize() { + if iconColor != nil, !iconColor!.isEmpty { + if let color = UIColor(named: iconColor!) { + image.setFillColor(color: color) + } + } return image.uiImage } else { return UIImage(named: "error.png") @@ -700,10 +706,15 @@ extension OpenHABSitemapViewController: UITableViewDelegate, UITableViewDataSour } } + var darkModeCacheKey = "" + if traitCollection.userInterfaceStyle == .dark { + darkModeCacheKey = "dark" + } + cell.imageView?.kf.setImage( - with: ImageResource(downloadURL: urlc, cacheKey: urlc.path + (urlc.query ?? "")), + with: ImageResource(downloadURL: urlc, cacheKey: urlc.path + (urlc.query ?? "") + widget!.iconColor + darkModeCacheKey), placeholder: UIImage(named: "blankicon.png"), - options: [.processor(OpenHABImageProcessor())], + options: [.processor(OpenHABImageProcessor(iconColor: widget!.iconColor))], completionHandler: reportOnResults ) } diff --git a/openHAB/Resources/Assets.xcassets/Contents.json b/openHAB/Resources/Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/aqua.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/aqua.colorset/Contents.json new file mode 100644 index 000000000..9746c2baa --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/aqua.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0xFF", + "red" : "0x00" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0xFF", + "red" : "0x00" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/black.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/black.colorset/Contents.json new file mode 100644 index 000000000..0c600f92f --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/black.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x00", + "red" : "0x00" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0xFF", + "red" : "0xFF" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/blue.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/blue.colorset/Contents.json new file mode 100644 index 000000000..c91f8ce65 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/blue.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0x00", + "red" : "0x00" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0x00", + "red" : "0x00" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/fuchsia.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/fuchsia.colorset/Contents.json new file mode 100644 index 000000000..c24966894 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/fuchsia.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0x00", + "red" : "0xFF" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0x00", + "red" : "0xFF" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/gold.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/gold.colorset/Contents.json new file mode 100644 index 000000000..343fad341 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/gold.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0xD7", + "red" : "0xFF" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0xD7", + "red" : "0xFF" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/gray.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/gray.colorset/Contents.json new file mode 100644 index 000000000..7b9b52c30 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/gray.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0x80", + "red" : "0x80" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xC0", + "green" : "0xC0", + "red" : "0xC0" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/green.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/green.colorset/Contents.json new file mode 100644 index 000000000..baa54c31a --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/green.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x80", + "red" : "0x00" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x80", + "red" : "0x00" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/lime.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/lime.colorset/Contents.json new file mode 100644 index 000000000..21a0570f3 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/lime.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0xFF", + "red" : "0x00" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0xFF", + "red" : "0x00" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/maroon.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/maroon.colorset/Contents.json new file mode 100644 index 000000000..bb5aa4990 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/maroon.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x00", + "red" : "0x80" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x00", + "red" : "0x80" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/navy.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/navy.colorset/Contents.json new file mode 100644 index 000000000..8140b433e --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/navy.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0x00", + "red" : "0x00" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0x00", + "red" : "0x00" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/olive.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/olive.colorset/Contents.json new file mode 100644 index 000000000..6fbcb8fa3 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/olive.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x80", + "red" : "0x80" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x80", + "red" : "0x80" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/orange.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/orange.colorset/Contents.json new file mode 100644 index 000000000..9b05e7224 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/orange.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0xA5", + "red" : "0xFF" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0xA5", + "red" : "0xFF" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/pink.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/pink.colorset/Contents.json new file mode 100644 index 000000000..1e6dac266 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/pink.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xCB", + "green" : "0xC0", + "red" : "0xFF" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xCB", + "green" : "0xC0", + "red" : "0xFF" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/purple.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/purple.colorset/Contents.json new file mode 100644 index 000000000..6092989e1 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/purple.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0x00", + "red" : "0x80" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0x00", + "red" : "0x80" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/red.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/red.colorset/Contents.json new file mode 100644 index 000000000..1421f313e --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/red.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x00", + "red" : "0xFF" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x00", + "red" : "0xFF" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/silver.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/silver.colorset/Contents.json new file mode 100644 index 000000000..9acb3646a --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/silver.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xC0", + "green" : "0xC0", + "red" : "0xC0" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0x80", + "red" : "0x80" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/teal.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/teal.colorset/Contents.json new file mode 100644 index 000000000..8792797b4 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/teal.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0x80", + "red" : "0x00" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0x80", + "red" : "0x00" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/white.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/white.colorset/Contents.json new file mode 100644 index 000000000..9c0e331e9 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/white.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0xFF", + "red" : "0xFF" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x00", + "red" : "0x00" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/Resources/Assets.xcassets/yellow.colorset/Contents.json b/openHAB/Resources/Assets.xcassets/yellow.colorset/Contents.json new file mode 100644 index 000000000..d4f0069e0 --- /dev/null +++ b/openHAB/Resources/Assets.xcassets/yellow.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0xFF", + "red" : "0xFF" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0xFF", + "red" : "0xFF" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/openHAB/SVGKImage+setFillColor.swift b/openHAB/SVGKImage+setFillColor.swift new file mode 100644 index 000000000..ae469807a --- /dev/null +++ b/openHAB/SVGKImage+setFillColor.swift @@ -0,0 +1,34 @@ +// Copyright (c) 2010-2023 Contributors to the openHAB project +// +// See the NOTICE file(s) distributed with this work for additional +// information. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0 +// +// SPDX-License-Identifier: EPL-2.0 + +import Foundation +import SVGKit + +extension SVGKImage { + private func setFillColorForSubLayer(layer: CALayer, color: UIColor) { + if layer is CAShapeLayer { + let shapeLayer = layer as! CAShapeLayer + shapeLayer.fillColor = color.cgColor + } + + if let sublayers = layer.sublayers { + for subLayer in sublayers { + setFillColorForSubLayer(layer: subLayer, color: color) + } + } + } + + func setFillColor(color: UIColor) { + if let layer = caLayerTree { + setFillColorForSubLayer(layer: layer, color: color) + } + } +}