I am retrieving football data from an API, and part of this data is the 'club colours'. The colours are arranged in a string like 'colour1 / colour2 / colour3' and so on. I am able to split this string into the separate colours with the following code
String[] splitClubColors = clubColors.split("/");
for(int i = 0; i < splitClubColors.length; i++) {
splitClubColors[i] = splitClubColors[i].trim().toLowerCase();
}
So now I have each colour as a separate string, for instance 'red', 'white' and 'black'.
I have two separate questions:
1) is it possible to convert a colour from its name form (e.g. 'blue') to a form that is useful in Android Studio (i.e. its hex code).
2) and is it possible to set the colorPrimary, colorPrimaryDark and colorAccent using these colours once they have been converted