Java Code Examples for protocolsupport.utils.Utils#getColorDiff()

The following examples show how to use protocolsupport.utils.Utils#getColorDiff() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChatColor.java    From ProtocolSupport with GNU Affero General Public License v3.0 6 votes vote down vote up
public ChatColor asBasic() {
	if (isBasic()) {
		return this;
	}

	ChatColor similarColor = null;
	long similarColorDiff = Long.MAX_VALUE;
	for (ChatColor basic : BASIC_BY_BUKKIT.values()) {
		long colorDiff = Utils.getColorDiff(getRed(), basic.getRed(), getGreen(), basic.getGreen(), getBlue(), basic.getBlue());
		if (colorDiff <= similarColorDiff) {
			similarColorDiff = colorDiff;
			similarColor = basic;
		}
	}
	return similarColor;
}
 
Example 2
Source File: MapColorHelper.java    From ProtocolSupport with GNU Affero General Public License v3.0 4 votes vote down vote up
private static long getDiff(IMapColor color1, IMapColor color2) {
	return Utils.getColorDiff(color1.getRed(), color2.getRed(), color1.getGreen(), color2.getGreen(), color1.getBlue(), color2.getBlue());
}