问题描述
java.awt.Color有一些定义的颜色 - 例如,Color.RED(或Color.red)是一个公共静态值,返回 Color(255,0,0) code>。但是只有有限的一组颜色定义 - 13我的数量。
有没有定义HTML颜色图表颜色的任何Java库,所以我可以说什么像ColorLibrary.AQUAMARINE,回来#60CC93?或者,更好的是,有库的映射名称的颜色,所以我可以说 Color color = ColorMap.get(aquamarine);
?
没有很多库已经编译了颜色名称到rgb /十六进制值的映射,但是有一些不同的库
java.awt.Color has a couple of defined Colors - for example, Color.RED (or Color.red) is a public static value that returns Color(255, 0, 0)
. But there are only a limited set of colors defined - 13 by my count.
Are there any Java libraries that have the HTML Color Chart colors defined, so I can say something like ColorLibrary.AQUAMARINE and get back #60CC93? Or, even better, are there libraries that map the name to the color, so I can say Color color = ColorMap.get("aquamarine");
?
There aren't many libraries which have compiled a map of colour names to rgb/hex values, however there are a few different libraries which provide functions to get colours which are predefined by java.
See:
http://www.java2s.com/Tutorial/Java/0261__2D-Graphics/Convertsagivenstringintoacolor.htm
这篇关于用于从颜色名称获取颜色的Java库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!