Start a project

Tool 73 of 425 · iOS colour

Colour to SwiftUI & UIColor

Turns a hex colour into Swift code and an asset catalog colorset you can drop into Xcode.

Colour to SwiftUI & UIColor

Your input

Result

Swift
Contents.json

    01

    What it does

    Turns a hex colour into Swift code and an asset catalog colorset you can drop into Xcode.

    • SwiftUI Color and UIColor
    • NSColor for macOS
    • Colorset JSON with dark variant
    • Display P3 note

    02

    Private by design

    Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

    03

    What you get

    Swift code and Contents.json, with a Copy and a Download button on every result.

    • SwiftUI
    • UIColor
    • Xcode

    Why it matters

    Hard-coding hex in Swift needs conversion to 0–1 components, and asset catalogs are the better way to support dark mode.

    Copy the code, or save the JSON as Contents.json in a .colorset folder.

    How to use it

    1. Type or paste your input; the example shows the format.
    2. Press Convert. Results also update as you type.
    3. Read the summary line, then the table, notes or output below it.
    4. Copy or download what you need. Nothing leaves this page.

    FAQ

    Asset catalog or code?

    Asset catalogs handle dark mode and high contrast automatically; prefer them.

    How is the dark colour chosen?

    A lighter version is suggested; change it in Xcode if needed.

    Is my input uploaded?

    No. The tool runs in your browser and nothing you type, paste or open is sent anywhere.

    Can I rely on the result?

    It follows the public specification or formula named on this page and says where it simplifies. Check anything critical against the official tool or documentation before you ship it.

    Work with me

    Want a site that gets these right?

    I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

    All developer tools · Back to leej.uk