0

I have some color costants defined in my css file. I'd like to get this values in my code (They were not used so far). Is there a way to do that?

-color1: rgb(58, 135, 173);
-color2: rgb(70, 136, 71);
db92
  • 183
  • 3
  • 16
  • Can you show the related portion of css / provide some clarification on what you need? – Peter Jun 07 '16 at 22:08
  • @Peter of course, I'd like to get those values, is it possible? Actually I'm using the Color.rgb() function directly in my java code, but I don't like this solution – db92 Jun 08 '16 at 05:55
  • Is the reason you don't like the Color.rgb() solution because you have to set it against the controls, or that you're not sure how to apply the constants in your css file? – Peter Jun 08 '16 at 17:08
  • @Peter I don't like this solution, because I have to set the rgb color two times, in the css and in the control. The constants work well in the css. I looked for a while in the web, but seems there aren't API so far that can help you to get directly the css value – db92 Jun 09 '16 at 05:49
  • @Peter I'm not talking just about the RGB values. You can get the css class if it's already applied to some Node, but if you want to read some css values, I guess it's impossible – db92 Jun 09 '16 at 05:51
  • Maybe this post can give you some ideas: http://stackoverflow.com/questions/1513587/looking-for-a-css-parser-in-java – Peter Jun 09 '16 at 12:32
  • @Peter Exactly as I thought, to use a CSS Parser is the only way possible. Thanks. – db92 Jun 09 '16 at 13:07

0 Answers0