Created
July 30, 2024 07:34
-
-
Save BasThomas/e5d3600011ea1a31350abb5d7dadeb92 to your computer and use it in GitHub Desktop.
Determines color names using three different APIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SwiftUI | |
for _ in 1...100 { | |
let color = Color( | |
red: .random(in: 0...1), | |
green: .random(in: 0...1), | |
blue: .random(in: 0...1) | |
) | |
let name1 = AXNameFromColor(color.cgColor!) | |
let name2 = UIColor(color).accessibilityName | |
let name3 = Text("\(accessibilityName: color)") | |
print(color) | |
print(name1) | |
print(name2) | |
print(name3) | |
print("====") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment