Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Color.Resolved to serialize Color on macOS 14+ #143

Open
sindresorhus opened this issue Jun 16, 2023 · 1 comment
Open

Use Color.Resolved to serialize Color on macOS 14+ #143

sindresorhus opened this issue Jun 16, 2023 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@sindresorhus
Copy link
Owner

sindresorhus commented Jun 16, 2023

https://developer.apple.com/documentation/swiftui/color/resolve(in:)
https://developer.apple.com/documentation/swiftui/color/resolved

It should be able to store the color better than what we currently do. We still need to preserve backwards compatibility, so we can first try loading it as Color.Resolved and if it fails, we can use the old way.

Color.Resolved is Codable, so we should use that for the serialization.

@sindresorhus sindresorhus added enhancement New feature or request help wanted Extra attention is needed labels Jun 16, 2023
@sindresorhus
Copy link
Owner Author

Hmm, actually, this means it would not be able to preserve colors that contain both light and dark variants. I wonder if that is currently supported with our current method.

himanshulahoti20 added a commit to himanshulahoti20/Defaults that referenced this issue Jan 8, 2024
Fixed Use Color.Resolved to serialize Color on macOS 14 in the Defaults+Extensions.swift file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant