vecino Well-Known Member Licensed User Longtime User Sep 4, 2017 #1 Hello, I'm having a lot of trouble to do something simple: In an import I get a string of text, for example, like this: "$0000FFFF" How can I convert that text string to b4a color number? Thank you very much.
Hello, I'm having a lot of trouble to do something simple: In an import I get a string of text, for example, like this: "$0000FFFF" How can I convert that text string to b4a color number? Thank you very much.
KMatle Expert Licensed User Longtime User Sep 4, 2017 #2 As B4A uses RGB values like this (The first 255 is the alpha value) B4X: Activity.Color=Colors.ARGB(255,100,149,237) You need to convert the hex values to integers B4X: dim hex as String dim intValue as Int hex = "FF" intValue = Bit.ParseInt(hex, 16); Remove the '$' and use a loop to get 2 chars each for the conversion. Nice tool: https://www.w3schools.com/colors/colors_converter.asp Upvote 0
As B4A uses RGB values like this (The first 255 is the alpha value) B4X: Activity.Color=Colors.ARGB(255,100,149,237) You need to convert the hex values to integers B4X: dim hex as String dim intValue as Int hex = "FF" intValue = Bit.ParseInt(hex, 16); Remove the '$' and use a loop to get 2 chars each for the conversion. Nice tool: https://www.w3schools.com/colors/colors_converter.asp
vecino Well-Known Member Licensed User Longtime User Sep 4, 2017 #3 Thanks for the help. I did not know "parseint". Regards. Upvote 0