mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-02-02 18:36:44 +01:00
Use colors from assets (IOS-152)
This commit is contained in:
parent
d406dcd553
commit
0fbe54d368
@ -0,0 +1,20 @@
|
||||
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIColor {
|
||||
public var hexValue: String {
|
||||
let components = cgColor.components
|
||||
|
||||
let red: CGFloat = components?[0] ?? 0.0
|
||||
let green: CGFloat = components?[1] ?? 0.0
|
||||
let blue: CGFloat = components?[2] ?? 0.0
|
||||
|
||||
return String(
|
||||
format: "#%02lX%02lX%02lX",
|
||||
lroundf(Float(red * 255)),
|
||||
lroundf(Float(green * 255)),
|
||||
lroundf(Float(blue * 255))
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.984",
|
||||
"green" : "0.173",
|
||||
"red" : "0.333"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.980",
|
||||
"green" : "0.541",
|
||||
"red" : "0.522"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
9
WidgetExtension/Assets.xcassets/Colors/Contents.json
Normal file
9
WidgetExtension/Assets.xcassets/Colors/Contents.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"provides-namespace" : true
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.000",
|
||||
"green" : "0.000",
|
||||
"red" : "0.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "1.000",
|
||||
"green" : "1.000",
|
||||
"red" : "1.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -91,8 +91,8 @@ struct HashtagWidgetView: View {
|
||||
extension Text {
|
||||
init(statusHTML htmlString: String, fontSize: Int = 16, fontWeight: Int = 400, colorScheme: ColorScheme = .light) {
|
||||
|
||||
let textColor = (colorScheme == .light) ? "#000000" : "#FFFFFF"
|
||||
let accentColor = (colorScheme == .light) ? "#563ACC" : "#858AFA"
|
||||
let textColor = (UIColor(named: "Colors/TextColor") ?? UIColor.gray).hexValue
|
||||
let accentColor = (UIColor(named: "Colors/Blurple") ?? UIColor.purple).hexValue
|
||||
|
||||
let fullHTML = """
|
||||
<!doctype html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user