3

If I search for a color, it returns me results in R.java:

public static final int cardview_light_background=0x7f040027;

How can I view this color code? It is an ARGB code and I can't find it easily.

Is there an easy way to see the color?

Jorgesys
  • 124,308
  • 23
  • 334
  • 268
live-love
  • 48,840
  • 22
  • 240
  • 204

2 Answers2

3

If you are looking into the R.java file, all the resources including colors are registered there but this value 0x7f040027 is a resource id but NOT a color.

public static final int cardview_light_background=0x7f040027;

You can see a preview inside the same colors.xml file and you must define the colors preferently here:

enter image description here

if you want to see the preview go directly to the colors.xml file.

As an example "#FFAABBCC"

  • FF : alpha channel
  • AA : Red Color.
  • BB : Green Color.
  • CC : Blue Color.

But wait, the color refered is a color from the SDK, to have a preview of this color you can write this line of code:

enter image description here

click in the blue description to get the preview in the left side from the SDK colors.xml file:

enter image description here


In internet you can find several pages to have a preview of the color, you can define the color as ARGB or Hexadecimal format.

https://www.hexcolortool.com/

Jorgesys
  • 124,308
  • 23
  • 334
  • 268
  • 1
    As an addition, once in the R class with the cursor positioned on the desired color one can use Go To Declaration(keyboard shortcut CTRL + B on Linux) to go to a file where that color is used and see the color on the left of the file like in the image from the answer. – user Dec 20 '17 at 18:13
-1

In your example, 0x7f040027, 0x means it's hexadecimal, 7f is the alpha value, 04 is the Red, 00 is the Green and 27 is the Blue. Go on your favorite online color chooser website and type that in you should be good to go.

  • Do you have any recommendation, most of the websites I have been to, you can't enter the whole value directly, like I wanted to enter: 7f040027 – live-love Dec 20 '17 at 17:59