Created
July 12, 2017 14:00
-
-
Save greggjaskiewicz/1e95abfe1e71378e302b2d32e116b170 to your computer and use it in GitHub Desktop.
how to convert int to hexadecmal colour value in swift 3
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
let hexColour = String(colour, radix: 16, uppercase: true) | |
let hexColourString = "000000\(hexColour)" | |
let range = hexColourString.index(hexColourString.endIndex, offsetBy: -6)..<hexColourString.endIndex | |
let hexHashColourString = hexColourString[range] | |
let textAttributeValue = "{font color='#\(hexHashColourString)'}{*font}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment