 	var hostName: String?
 }
 
+extension String {
+
+	func asciiValue() -> Int {
+		var s = UInt32(0)
+		for ch in self.unicodeScalars {
+			if ch.isASCII {
+				s += ch.value
+			}
+		}
+		return Int(s)
+	}
+}
+
 class LogoLoader {
 
 	private static let dbVersion = "1483980213630"

			if self._logoDB == nil {
				if let path = Bundle.main.path(forResource: "logo-database", ofType: "json", inDirectory: "Extension/build/mobile/search/core"),
				   let jsonData = try? Data(contentsOf: URL(fileURLWithPath: path), options: .mappedIfSafe) as Data {
					self._logoDB = JSON(jsonData)["domains"]
				}
			}
			return self._logoDB

						}
					}
				}
			}
		}
		if logoDetails.color == nil {
			logoDetails.color = "000000"
			let palette = self.logoDB?["palette"]
			if let list = palette?.array,
				let asciiVal = logoDetails.hostName?.asciiValue() {
				let idx = asciiVal % list.count
				logoDetails.color = list[idx].string
			}
		}
		return logoDetails
