moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

Color references are too limited

Open dalewking opened this issue 3 years ago • 1 comments

Color references (i.e. @color/xxxx) have some serious limitations:

  • They require the referenced color to be defined before it can be referenced. The following will not work, but does if you reverse the order of the lines: <color name="foo">@color/bar</color> <color name="bar">#ABCDEF</color>
  • They also do not allow referencing a color defined in another file. It is possible to have more than one colors.xml file but I cannot reference a color defined in one file from another.

All of the color information should be read in before trying to resolve the references

dalewking avatar Jun 02 '22 16:06 dalewking

If you wonder why this would be necessary, we have a corporate library defining some styles and colors for Android. I want to actually pull that file into the build as is and use it and it has colors that are referenced before being defined (which is allowed by Android) and then I want the project specific colors file to just reference the colors defined in the corporate file.

dalewking avatar Jun 02 '22 16:06 dalewking