Question: I want to convert the string to color but I can't,

**My Code**

```
String color = "0xffff5252";
Color result= Color(int.parse(color, radix: 16));
print("$result");

```

\*\* I get the following problem\*\*

`Invalid radix-16 number (at character 1) 0xffff5252`

Answer: 
You can use the follow code:

```
var newRandomColor = Math.floor(Math.random()*16777215).toString(16)

```

This code works for generate random colors. Hope it helps you
For specifically an RGB color code you can use:

```
function RGBcolor() {
  var R = Math.floor(Math.random() * 256);
  var G = Math.floor(Math.random() * 256);
  var B = Math.floor(Math.random() * 256);
  var randomcolor = "rgb(" + R + "," + G + "," + B + ")";  
  console.log(randomcolor);
}

RGBcolor();

```

Hope it helps too!