Repository: Infomaniak/ios-core-ui
Pull request #95: refactor: Move some mail components to core
Author: login: PhilippeWeidmann
Created: 2025-05-16T13:07:38Z | Merged: 2025-05-22T07:15:35Z

AvatarImage
InitialsView
Font + Color extensions


Diff:
diff --git a/Package.resolved b/Package.resolved
index 67ace8d..76db3c8 100644
--- a/Package.resolved
+++ b/Package.resolved
@@ -14,8 +14,8 @@
       "kind" : "remoteSourceControl",
       "location" : "https://github.com/Infomaniak/ios-core",
       "state" : {
-        "revision" : "f9664e0b91a79d86373cafa87f89e0a45deb3128",
-        "version" : "15.0.0"
+        "revision" : "df97b17e5a4f0117b53ea76c847831745e0d862c",
+        "version" : "15.3.0"
       }
     },
     {
@@ -23,8 +23,8 @@
       "kind" : "remoteSourceControl",
       "location" : "https://github.com/Infomaniak/ios-dependency-injection",
       "state" : {
-        "revision" : "7d127ead20bbb4a6a39ca60e6dc32e580197b59e",
-        "version" : "2.0.2"
+        "revision" : "86f3b77f71547b7778d2819d4d1c2d77847f2069",
+        "version" : "2.0.4"
       }
     },
     {
@@ -59,8 +59,8 @@
       "kind" : "remoteSourceControl",
       "location" : "https://github.com/MarcoEidinger/OSInfo.git",
       "state" : {
-        "revision" : "54fd6673923ef5966268918152235b0e15ed057c",
-        "version" : "1.0.1"
+        "revision" : "fa5164afc8ef56c3069728629647f140c03933f5",
+        "version" : "1.0.2"
       }
     },
     {
@@ -68,8 +68,8 @@
       "kind" : "remoteSourceControl",
       "location" : "https://github.com/realm/realm-core.git",
       "state" : {
-        "revision" : "85eeca41654cc9070ad81a21a4b1d153ad467c33",
-        "version" : "14.13.1"
+        "revision" : "cccb3ca9e26ec452a29f2f0d4050d1e38b8a3d43",
+        "version" : "14.14.0"
       }
     },
     {
@@ -77,8 +77,8 @@
       "kind" : "remoteSourceControl",
       "location" : "https://github.com/realm/realm-swift",
       "state" : {
-        "revision" : "a3abcdf95a3176f5ad990239920aad4ef86e00de",
-        "version" : "10.54.2"
+        "revision" : "d94d44781167fbb8d7a46fb181e784a6446ca5c1",
+        "version" : "10.54.4"
       }
     },
     {
@@ -86,8 +86,8 @@
       "kind" : "remoteSourceControl",
       "location" : "https://github.com/getsentry/sentry-cocoa",
       "state" : {
-        "revision" : "0c34e4da899a1dd9183db04082d1ceb6e9c2b301",
-        "version" : "8.44.0"
+        "revision" : "d87b07a27cd9a082d367261d7199a96a54e59f1d",
+        "version" : "8.50.2"
       }
     },
     {
diff --git a/Package.swift b/Package.swift
index cec76c7..d85c225 100644
--- a/Package.swift
+++ b/Package.swift
@@ -36,7 +36,7 @@ let package = Package(
         )
     ],
     dependencies: [
-        .package(url: "https://github.com/Infomaniak/ios-core", .upToNextMajor(from: "15.0.0")),
+        .package(url: "https://github.com/Infomaniak/ios-core", .upToNextMajor(from: "15.2.0")),
         .package(url: "https://github.com/Infomaniak/SnackBar.swift", .upToNextMajor(from: "1.2.0")),
         .package(url: "https://github.com/onevcat/Kingfisher", .upToNextMajor(from: "7.10.0")),
         .package(url: "https://github.com/matomo-org/matomo-sdk-ios", .upToNextMajor(from: "7.5.2")),
diff --git a/Sources/InfomaniakCoreCommonUI/OrganisationColors.swift b/Sources/DesignSystem/Extensions/Color+Extension.swift
similarity index 55%
rename from Sources/InfomaniakCoreCommonUI/OrganisationColors.swift
rename to Sources/DesignSystem/Extensions/Color+Extension.swift
index f6f5eba..e41de8e 100644
--- a/Sources/InfomaniakCoreCommonUI/OrganisationColors.swift
+++ b/Sources/DesignSystem/Extensions/Color+Extension.swift
@@ -1,6 +1,6 @@
 /*
  Infomaniak Core UI - iOS
- Copyright (C) 2023 Infomaniak Network SA
+ Copyright (C) 2025 Infomaniak Network SA
 
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
@@ -16,15 +16,22 @@
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-import UIKit
+import SwiftUI
 
-public extension UIColor {
-    static let organisationColors: [UIColor] = Array(0 ... 9)
-        .map { UIColor(named: "organisationColor\($0)", in: Bundle.module, compatibleWith: nil) }
-        .compactMap { $0 }
+#if os(macOS)
+public typealias PlatformColor = NSColor
+#elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
+public typealias PlatformColor = UIColor
+#endif
 
-    class func backgroundColor(from userId: Int, with colors: [UIColor] = UIColor.organisationColors) -> UIColor {
-        let colorIndex = abs(userId % colors.count)
-        return colors[colorIndex]
+public extension PlatformColor {
+    convenience init(light: PlatformColor, dark: PlatformColor) {
+        self.init { $0.userInterfaceStyle == .dark ? dark : light }
+    }
+}
+
+public extension Color {
+    init(light: PlatformColor, dark: PlatformColor) {
+        self.init(uiColor: UIColor(light: light, dark: dark))
     }
 }
diff --git a/Sources/DesignSystem/Extensions/Font+Extension.swift b/Sources/DesignSystem/Extensions/Font+Extension.swift
new file mode 100644
index 0000000..5fabfcd
--- /dev/null
+++ b/Sources/DesignSystem/Extensions/Font+Extension.swift
@@ -0,0 +1,42 @@
+/*
+ Infomaniak Core UI - iOS
+ Copyright (C) 2025 Infomaniak Network SA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import SwiftUI
+
+public extension Font {
+    /// Create a custom font with the UIFont preferred font family.
+    /// - Parameters:
+    ///   - size: Default size of the font for the "large" `Dynamic Type Size`.
+    ///   - weight: Weight of the font.
+    ///   - textStyle: The text style on which the font will be based to scale.
+    ///
+    /// - Returns: A font with the specified attributes.
+    ///
+    /// SwiftUI will use the default system font with the specified weight and size use `Dynamic Type Size`.
+    static func dynamicTypeSizeFont(size: CGFloat, weight: Weight, relativeTo textStyle: TextStyle) -> Font {
+        #if canImport(UIKit)
+        let fontFamily = UIFont.preferredFont(forTextStyle: .body).familyName
+        return custom(fontFamily, size: size, relativeTo: textStyle).weight(weight)
+        #elseif canImport(AppKit)
+        let fontFamily = NSFont.preferredFont(forTextStyle: .body).familyName
+        return custom(fontFamily, size: size, relativeTo: textStyle).weight(weight)
+        #else
+        fatalError("Unsupported UI platform")
+        #endif
+    }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/Contents.json
index 73c0059..25a219f 100644
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/Contents.json
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/Contents.json
@@ -2,5 +2,8 @@
   "info" : {
     "author" : "xcode",
     "version" : 1
+  },
+  "properties" : {
+    "generate-swift-asset-symbol-extensions" : "enabled"
   }
 }
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/Contents.json
new file mode 100644
index 0000000..6e96565
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/Contents.json
@@ -0,0 +1,9 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  },
+  "properties" : {
+    "provides-namespace" : true
+  }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/cobaltColor.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/cobaltColor.colorset/Contents.json
new file mode 100644
index 0000000..6da3cc0
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/cobaltColor.colorset/Contents.json
@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xB2",
+          "green" : "0x6A",
+          "red" : "0x00"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xF5",
+          "green" : "0xB2",
+          "red" : "0x0A"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/coralColor.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/coralColor.colorset/Contents.json
new file mode 100644
index 0000000..c106e47
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/coralColor.colorset/Contents.json
@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x0B",
+          "green" : "0x54",
+          "red" : "0xFF"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x59",
+          "green" : "0x94",
+          "red" : "0xFD"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/fougereColor.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/fougereColor.colorset/Contents.json
new file mode 100644
index 0000000..d8de92b
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/fougereColor.colorset/Contents.json
@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x88",
+          "green" : "0x96",
+          "red" : "0x00"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xB3",
+          "green" : "0xC7",
+          "red" : "0x00"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/grassColor.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/grassColor.colorset/Contents.json
new file mode 100644
index 0000000..635f3c1
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/grassColor.colorset/Contents.json
@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x50",
+          "green" : "0xAF",
+          "red" : "0x4B"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x93",
+          "green" : "0xD0",
+          "red" : "0x90"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/jeanColor.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/jeanColor.colorset/Contents.json
new file mode 100644
index 0000000..42f844f
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/jeanColor.colorset/Contents.json
@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xF3",
+          "green" : "0x96",
+          "red" : "0x21"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xF8",
+          "green" : "0xC4",
+          "red" : "0x81"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/mauveColor.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/mauveColor.colorset/Contents.json
new file mode 100644
index 0000000..9bee207
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/mauveColor.colorset/Contents.json
@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xC8",
+          "green" : "0x68",
+          "red" : "0xBA"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xD6",
+          "green" : "0x8F",
+          "red" : "0xCC"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/princeColor.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/princeColor.colorset/Contents.json
new file mode 100644
index 0000000..030d3f4
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/princeColor.colorset/Contents.json
@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xB7",
+          "green" : "0x3A",
+          "red" : "0x67"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xDD",
+          "green" : "0x6D",
+          "red" : "0x95"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/tropicalColor.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/tropicalColor.colorset/Contents.json
new file mode 100644
index 0000000..099faf6
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/tropicalColor.colorset/Contents.json
@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xD4",
+          "green" : "0xBC",
+          "red" : "0x00"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xEA",
+          "green" : "0xDE",
+          "red" : "0x86"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/yellowColor.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/yellowColor.colorset/Contents.json
new file mode 100644
index 0000000..95a8912
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/InfomaniakColors/yellowColor.colorset/Contents.json
@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x0A",
+          "green" : "0xC1",
+          "red" : "0xFF"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x9E",
+          "green" : "0xDF",
+          "red" : "0xFF"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/backgroundCardView.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/backgroundCardView.colorset/Contents.json
index 7561b66..5a4b4df 100644
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/backgroundCardView.colorset/Contents.json
+++ b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/backgroundCardView.colorset/Contents.json
@@ -23,9 +23,9 @@
         "color-space" : "srgb",
         "components" : {
           "alpha" : "1.000",
-          "blue" : "0.188",
-          "green" : "0.184",
-          "red" : "0.180"
+          "blue" : "0x2F",
+          "green" : "0x2E",
+          "red" : "0x2D"
         }
       },
       "idiom" : "universal"
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor0.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor0.colorset/Contents.json
deleted file mode 100644
index 5004844..0000000
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor0.colorset/Contents.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  "colors" : [
-    {
-      "color" : {
-        "color-space" : "srgb",
-        "components" : {
-          "alpha" : "1.000",
-          "blue" : "0xB4",
-          "green" : "0x74",
-          "red" : "0x79"
-        }
-      },
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor1.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor1.colorset/Contents.json
deleted file mode 100644
index 3449b8b..0000000
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor1.colorset/Contents.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-  "colors" : [
-    {
-      "color" : {
-        "color-space" : "srgb",
-        "components" : {
-          "alpha" : "1.000",
-          "blue" : "0xBB",
-          "green" : "0x90",
-          "red" : "0x39"
-        }
-      },
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  },
-  "properties" : {
-    "localizable" : true
-  }
-}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor2.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor2.colorset/Contents.json
deleted file mode 100644
index 6c966fc..0000000
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor2.colorset/Contents.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  "colors" : [
-    {
-      "color" : {
-        "color-space" : "srgb",
-        "components" : {
-          "alpha" : "1.000",
-          "blue" : "0xB9",
-          "green" : "0xA1",
-          "red" : "0x00"
-        }
-      },
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor3.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor3.colorset/Contents.json
deleted file mode 100644
index a118a02..0000000
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor3.colorset/Contents.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  "colors" : [
-    {
-      "color" : {
-        "color-space" : "srgb",
-        "components" : {
-          "alpha" : "1.000",
-          "blue" : "0xFF",
-          "green" : "0xAB",
-          "red" : "0x30"
-        }
-      },
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor4.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor4.colorset/Contents.json
deleted file mode 100644
index 19e2e81..0000000
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor4.colorset/Contents.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  "colors" : [
-    {
-      "color" : {
-        "color-space" : "srgb",
-        "components" : {
-          "alpha" : "1.000",
-          "blue" : "0x88",
-          "green" : "0x96",
-          "red" : "0x02"
-        }
-      },
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor5.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor5.colorset/Contents.json
deleted file mode 100644
index 44443d6..0000000
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor5.colorset/Contents.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  "colors" : [
-    {
-      "color" : {
-        "color-space" : "srgb",
-        "components" : {
-          "alpha" : "1.000",
-          "blue" : "0x72",
-          "green" : "0xB5",
-          "red" : "0x3C"
-        }
-      },
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor6.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor6.colorset/Contents.json
deleted file mode 100644
index b66d060..0000000
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor6.colorset/Contents.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  "colors" : [
-    {
-      "color" : {
-        "color-space" : "srgb",
-        "components" : {
-          "alpha" : "1.000",
-          "blue" : "0x00",
-          "green" : "0xC3",
-          "red" : "0xFF"
-        }
-      },
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor7.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor7.colorset/Contents.json
deleted file mode 100644
index d6d8cc7..0000000
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor7.colorset/Contents.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  "colors" : [
-    {
-      "color" : {
-        "color-space" : "srgb",
-        "components" : {
-          "alpha" : "1.000",
-          "blue" : "0x6E",
-          "green" : "0x2C",
-          "red" : "0xED"
-        }
-      },
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}
diff --git a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor8.colorset/Contents.json b/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor8.colorset/Contents.json
deleted file mode 100644
index c6c72df..0000000
--- a/Sources/InfomaniakCoreCommonUI/Assets.xcassets/organisationColor8.colorset/Contents.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  "colors" : [
-    {
-      "color" : {
-        "color-space" : "srgb",
-        "components" : {
-          "alpha" : "1.000",
-          "blue" : "0x3A",
-          "green" : "0x28",
-          "red" : "0xD9"
-        }
-      },
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}
diff --git a/Sources/InfomaniakCoreCommonUI/AvatarColors.swift b/Sources/InfomaniakCoreCommonUI/AvatarColors.swift
new file mode 100644
index 0000000..4ba8300
--- /dev/null
+++ b/Sources/InfomaniakCoreCommonUI/AvatarColors.swift
@@ -0,0 +1,61 @@
+/*
+ Infomaniak Core UI - iOS
+ Copyright (C) 2025 Infomaniak Network SA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if canImport(UIKit)
+import UIKit
+
+public extension UIColor {
+    static let avatarColors = [
+        UIColor.InfomaniakColors.yellow,
+        UIColor.InfomaniakColors.coral,
+        UIColor.InfomaniakColors.grass,
+        UIColor.InfomaniakColors.fougere,
+        UIColor.InfomaniakColors.cobalt,
+        UIColor.InfomaniakColors.jean,
+        UIColor.InfomaniakColors.tropical,
+        UIColor.InfomaniakColors.mauve,
+        UIColor.InfomaniakColors.prince
+    ]
+
+    class func backgroundColor(from hash: Int, with colors: [UIColor] = UIColor.avatarColors) -> UIColor {
+        let colorIndex = abs(hash % colors.count)
+        return colors[colorIndex]
+    }
+}
+#endif
+
+import SwiftUI
+
+public extension Color {
+    static let avatarColors = [
+        Color.InfomaniakColors.yellow,
+        Color.InfomaniakColors.coral,
+        Color.InfomaniakColors.grass,
+        Color.InfomaniakColors.fougere,
+        Color.InfomaniakColors.cobalt,
+        Color.InfomaniakColors.jean,
+        Color.InfomaniakColors.tropical,
+        Color.InfomaniakColors.mauve,
+        Color.InfomaniakColors.prince
+    ]
+
+    static func backgroundColor(from hash: Int, with colors: [Color] = Color.avatarColors) -> Color {
+        let colorIndex = abs(hash % colors.count)
+        return colors[colorIndex]
+    }
+}
diff --git a/Sources/InfomaniakCoreSwiftUI/Components/AvatarView/AvatarImage.swift b/Sources/InfomaniakCoreSwiftUI/Components/AvatarView/AvatarImage.swift
new file mode 100644
index 0000000..b91b733
--- /dev/null
+++ b/Sources/InfomaniakCoreSwiftUI/Components/AvatarView/AvatarImage.swift
@@ -0,0 +1,47 @@
+/*
+ Infomaniak Core UI - iOS
+ Copyright (C) 2025 Infomaniak Network SA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import SwiftUI
+
+public struct AvatarImage: View {
+    let image: Image
+    let size: CGFloat
+
+    public init(image: Image, size: CGFloat) {
+        self.image = image
+        self.size = size
+    }
+
+    public var body: some View {
+        ZStack {
+            Circle()
+                .fill(.white)
+
+            image
+                .resizable()
+                .scaledToFit()
+                .clipShape(Circle())
+        }
+        .frame(width: size, height: size)
+        .drawingGroup()
+    }
+}
+
+#Preview {
+    AvatarImage(image: Image(systemName: "person"), size: 40)
+}
diff --git a/Sources/InfomaniakCoreSwiftUI/Components/AvatarView/InitialsView.swift b/Sources/InfomaniakCoreSwiftUI/Components/AvatarView/InitialsView.swift
new file mode 100644
index 0000000..1b480a6
--- /dev/null
+++ b/Sources/InfomaniakCoreSwiftUI/Components/AvatarView/InitialsView.swift
@@ -0,0 +1,48 @@
+/*
+ Infomaniak Core UI - iOS
+ Copyright (C) 2025 Infomaniak Network SA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import SwiftUI
+
+public struct InitialsView: View {
+    let initials: String
+    let backgroundColor: Color
+    let foregroundColor: Color
+    let size: CGFloat
+
+    public init(initials: String, backgroundColor: Color, foregroundColor: Color, size: CGFloat) {
+        self.initials = initials
+        self.backgroundColor = backgroundColor
+        self.foregroundColor = foregroundColor
+        self.size = size
+    }
+
+    public var body: some View {
+        ZStack {
+            Circle()
+                .fill(backgroundColor)
+            Text(initials)
+                .font(.system(size: size * 0.5, weight: .semibold))
+                .foregroundStyle(foregroundColor)
+        }
+        .frame(width: size, height: size)
+    }
+}
+
+#Preview {
+    InitialsView(initials: "TE", backgroundColor: .red, foregroundColor: .white, size: 40)
+}
diff --git a/Sources/InfomaniakCoreUIKit/Extension/UIImage+Extension.swift b/Sources/InfomaniakCoreUIKit/Extension/UIImage+Extension.swift
index 87af510..a23c244 100644
--- a/Sources/InfomaniakCoreUIKit/Extension/UIImage+Extension.swift
+++ b/Sources/InfomaniakCoreUIKit/Extension/UIImage+Extension.swift
@@ -16,6 +16,7 @@
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+import InfomaniakCore
 import UIKit
 
 public enum ImageUtil {
@@ -200,7 +201,7 @@ public extension UIImage {
         foregroundColor: UIColor = .white,
         backgroundColor: UIColor
     ) -> UIImage {
-        let initials = name.initials
+        let initials = NameFormatter(fullName: name).initials
         let defaultFontRatio: CGFloat = 14.0 / 40.0
         let frame = CGRect(origin: .zero, size: size)
         let attributes: [NSAttributedString.Key: Any] = [


Reviews:
user: login: valentinperignon
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-22T06:45:57Z
user: login: valentinperignon
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-22T07:15:29Z

Review comments:
diff_hunk: @@ -0,0 +1,42 @@
+/*
+ Infomaniak Core UI - iOS
+ Copyright (C) 2025 Infomaniak Network SA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import SwiftUI
+
+public struct AvatarImage: View {
path: Sources/InfomaniakCoreSwiftUI/Components/AvatarView/AvatarImage.swift
user: login: valentinperignon
body: Can you update this view with the latest version of ContactImage
created_at: 2025-05-22T06:44:18Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,53 @@
+/*
+ Infomaniak Mail - iOS App
+ Copyright (C) 2022 Infomaniak Network SA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import SwiftUI
+
+public struct IKDivider: View {
path: Sources/InfomaniakCoreSwiftUI/Components/IKDivider.swift
user: login: valentinperignon
body: The logic of this divider is really tied to Mail. Maybe you can use a simple Divider in the login view
created_at: 2025-05-22T06:45:48Z
author_association: MEMBER

PR comments:
user: login: sonarqubecloud[bot]
created_at: 2025-05-22T07:14:19Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=Infomaniak_ios-core-ui&pullRequest=95) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=Infomaniak_ios-core-ui&pullRequest=95&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=Infomaniak_ios-core-ui&pullRequest=95&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=Infomaniak_ios-core-ui&pullRequest=95&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=Infomaniak_ios-core-ui&pullRequest=95&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=Infomaniak_ios-core-ui&pullRequest=95&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=Infomaniak_ios-core-ui&pullRequest=95)


author_association: NONE