Color preview in Android Studio
It's not possible for int
ARGB values, because the IDE can't understand that they're colors, for they might be just numbers.
On the other hand, it can show the color preview in the gutter when you're referring to a resource because, parsing R.color.yourColor
, the IDE understands that it's a color by the qualifier R.color
rather than R.dimen
or something.
Alternatively, you may look into writing a plugin for Android Studio in order to achieve the desired result.
It's only possible for the colors registered as resource (by the developer as in colors.xml or exists as some Android's resource).
Refer this link given below for more info.
Is there an easy way to see a color in Android Studio?
In the case you know all your colours beforehand, import all of them inside the colors.xml
file and then each time you use a colour, it will always be displayed on the left. The code will look like this:
public static void obsidian(ucTheme theme) {
theme.background_color = R.color.obsidian;
theme.id = 1000;
}
And the final result will be this: