---
title: "Comment by Maximiliano taccone on \"From Hex to Color and Back in SwiftUI\" | Hashnode"
description: "Hello!!! thanks for the blog.!! An erro is in RGBA HexToUIColor This works OK.. a = CGFloat((hexNumber &amp; 0xff000000) &gt;&gt; 24) / 255 r = CGFloat((hexNumb"
url: "https://hashnode.com/posts/from-hex-to-color-and-back-in-swiftui/62139d2ef56c896b3792f1f2/comment/64b97800a884f3de56a27168"
---

[Discussion](https://hashnode.com/posts/from-hex-to-color-and-back-in-swiftui/62139d2ef56c896b3792f1f2)

Comment [From Hex to Color and Back in SwiftUI](https://hashnode.com/posts/from-hex-to-color-and-back-in-swiftui/62139d2ef56c896b3792f1f2)

[Maximiliano taccone](https://hashnode.com/@MaxxANDROIDIOS)

[Jul 20, 2023](https://hashnode.com/posts/from-hex-to-color-and-back-in-swiftui/62139d2ef56c896b3792f1f2/comment/64b97800a884f3de56a27168)

Hello!!! thanks for the blog.!! An erro is in RGBA HexToUIColor

This works OK..

a = CGFloat((hexNumber & 0xff000000) >> 24) / 255 r = CGFloat((hexNumber & 0x00ff0000) >> 16) / 255 g = CGFloat((hexNumber & 0x0000ff00) >> 8) / 255 b = CGFloat(hexNumber & 0x000000ff) / 255

Best for you!! Maximiliano Taccone
