且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如果颜色未知,如何从十六进制值获取颜色名称

更新时间:2023-01-27 10:33:21

获取所有颜色名称,并使用其十六进制值作为键将它们放入字典中.检查字典以查看您使用的十六进制值是否存在.如果是这样,请从字典中获取值,然后您便拥有颜色名称.
Get all the color names, and put them in a dictionary using their hex value as the key. Check the dictionary to see if the hex value you are working with exists. If it does, get the value out of the dictionary and you have your color name.


如果您确实想要颜色名称,将无济于事.
但是,如果您需要该十六进制值中的颜色对象,则可以使用

If you really want the color name, can''t help.
But if you require color object from that Hex value, then you can use

Dim c As Color = ColorTranslator.FromHtml("#25A595")