Get the color table index for a color.
@param rgb the color
@return the index
329125
@Override
    public int getIndexForColor(int rgb) {
        int red = (rgb >> 16) & 0xff;
        int green = (rgb >> 8) & 0xff;
        int blue = rgb & 0xff;

        OctTreeNode node = root;

        for (int level = 0; level <= MAX_LEVEL; level++) {
            OctTreeNode child;
            int bit = 0x80 >> level;

            int index = 0;
            if ((red & bit) != 0)
                index += 4;
            if ((green & bit) != 0)
                index += 2;
            if ((blue & bit) != 0)
                index += 1;

            child = node.leaf[index];

            if (child == null)
                return node.index;
            else if (child.isLeaf)
                return child.index;
            else
                node = child;
        }
        LOGGER.fine("getIndexForColor failed");
        return 0;
    }
687687
public int getBackgroundColor() {
        return Color.argb(Colors.glToByte(getBackgroundColorA()), //
                Colors.glToByte(getBackgroundColorR()), //
                Colors.glToByte(getBackgroundColorG()), //
                Colors.glToByte(getBackgroundColorB()));
    }
1204516
private Map<String, Table> getIndex(Table table)
   {
      Map<String, Table> result;

      if (!table.getResourceFlag())
      {
         result = m_taskTablesByName;
      }
      else
      {
         result = m_resourceTablesByName;
      }
      return result;
   }
669445
public Set<RGBColor> colours() {
        return stream().map(Pixel::toColor).collect(Collectors.toSet());
    }
178927
public float getColorR(int vertex, int colorset) {
        if (!hasColors(colorset)) {
            throw new IllegalStateException("mesh has no colorset " + colorset);
        }
        
        checkVertexIndexBounds(vertex);
        /* bound checks for colorset are done by java for us */
        
        return m_colorsets[colorset].getFloat(vertex * 4 * SIZEOF_FLOAT);
    }
272196
public static RGBColor rgb(int r, int g, int b) {
    return new RGBColor(makeRgb(r, g, b));
  }
614144
public CMYKColor getComplementaryColor() {
        double[] rgb = CMYKColor.getRGB(cyan, magenta, yellow, black);
        double[] cmyk = CMYKColor.getCMYK(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]);
        return new CMYKColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
    }
7058
public final Color getColor(int x, int y) {
        int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
        int idx = x + y * width;

        return new RGBColor((pixels[idx] >> 16 & 0x000000ff) / 255.0,
                            (pixels[idx] >> 8  & 0x000000ff) / 255.0,
                            (pixels[idx]       & 0x000000ff) / 255.0,
                            (pixels[idx] >> 24)              / 255.0);
    }
173870
public static Color getRGBColor(String name)
			throws IllegalArgumentException {
		int[] c = { 0, 0, 0, 0 };
		if (name.startsWith("#")) {
			if (name.length() == 4) {
				c[0] = Integer.parseInt(name.substring(1, 2), 16) * 16;
				c[1] = Integer.parseInt(name.substring(2, 3), 16) * 16;
				c[2] = Integer.parseInt(name.substring(3), 16) * 16;
				return new Color(c[0], c[1], c[2], c[3]);
			}
			if (name.length() == 7) {
				c[0] = Integer.parseInt(name.substring(1, 3), 16);
				c[1] = Integer.parseInt(name.substring(3, 5), 16);
				c[2] = Integer.parseInt(name.substring(5), 16);
				return new Color(c[0], c[1], c[2], c[3]);
			}
			throw new IllegalArgumentException(
					"Unknown color format. Must be #RGB or #RRGGBB");
		}
        else if (name.startsWith("rgb(")) {
            StringTokenizer tok = new StringTokenizer(name, "rgb(), \t\r\n\f");
            for (int k = 0; k < 3; ++k) {
                String v = tok.nextToken();
                if (v.endsWith("%"))
                    c[k] = Integer.parseInt(v.substring(0, v.length() - 1)) * 255 / 100;
                else
                    c[k] = Integer.parseInt(v);
                if (c[k] < 0)
                    c[k] = 0;
                else if (c[k] > 255)
                    c[k] = 255;
            }
            return new Color(c[0], c[1], c[2], c[3]);
        }
		name = name.toLowerCase();
		if (!NAMES.containsKey(name))
			throw new IllegalArgumentException("Color '" + name
					+ "' not found.");
		c = (int[]) NAMES.get(name);
		return new Color(c[0], c[1], c[2], c[3]);
	}
1061140
def get_rgb_color(color):
    
    if color == INVERTED:
        foreground = (0, 255, 0)
        background = (0, 65, 0)
    elif color == NORMAL:
        foreground = (0, 65, 0)
        background = (0, 255, 0)
    else:
        foreground = (0, 0, 0)
        background = COLOR_INFO[color]
    return (foreground, background)
293544
private static final double[] getRGB(double cyan, double magenta, double yellow, double black) {
        double[] rgb = {0.0, 0.0, 0.0};

        rgb[0] = 1.0 - Math.min(1.0, cyan    * (1.0 - black) + black);
        rgb[1] = 1.0 - Math.min(1.0, magenta * (1.0 - black) + black);
        rgb[2] = 1.0 - Math.min(1.0, yellow  * (1.0 - black) + black);

        return rgb;
    }
1160944
public int getRenderIndexFromRealIdx(final int realIdx) {
        if (columnMapping == null || realIdx == -1) {
            return realIdx;
        }

        for (final Entry<Integer, Integer> entry : columnMapping.entrySet()) {
            if (entry.getValue().equals(realIdx)) {
                return entry.getKey();
            }
        }

        return realIdx;
    }
29323
@SuppressWarnings({ "checkstyle:magicnumber", "static-method" })
	@Pure
	public Color rgb(int color) {
		final int red = (color & 0x00FF0000) >> 16;
		final int green = (color & 0x0000FF00) >> 8;
		final int blue = color & 0x000000FF;
		return Color.rgb(red, green, blue);
	}
377106
public int getColorByLayer( DwgObject entity ) {
        int colorByLayer = 0;
        int layer = entity.getLayerHandle();
        for( int j = 0; j < layerTable.size(); j++ ) {
            Vector layerTableRecord = (Vector) layerTable.get(j);
            int lHandle = ((Integer) layerTableRecord.get(0)).intValue();
            if (lHandle == layer) {
                colorByLayer = ((Integer) layerTableRecord.get(2)).intValue();
            }
        }
        return colorByLayer;
    }
884610
public static int getDisplayColorFromColor(int color) {
        if (!isJellybeanOrLater()) {
            return color;
        }

        float[] hsv = new float[3];
        Color.colorToHSV(color, hsv);
        hsv[1] = Math.min(hsv[1] * SATURATION_ADJUST, 1.0f);
        hsv[2] = hsv[2] * INTENSITY_ADJUST;
        return Color.HSVToColor(hsv);
    }
435225
function (rgbColor) {
            // TODO : Memoize this function by caching its input

            var match = rgbaRx.exec(rgbColor);
            if (match) {
                return this.setColor(+match[1], +match[2], +match[3], +match[5]);
            }

            return this.parseHex(rgbColor);
        }
1086483
private int getColor(int value) {
		if (value == 0) {
			return 0;
		}

		double scale = Math.log10(value) / Math.log10(this.topValue);
		double lengthScale = Math.min(1.0, scale) * (colors.length - 1);
		int index = 1 + (int) lengthScale;
		if (index == colors.length) {
			index--;
		}
		double partScale = lengthScale - (index - 1);

		int r = (int) (colors[index - 1][0] + partScale
				* (colors[index][0] - colors[index - 1][0]));
		int g = (int) (colors[index - 1][1] + partScale
				* (colors[index][1] - colors[index - 1][1]));
		int b = (int) (colors[index - 1][2] + partScale
				* (colors[index][2] - colors[index - 1][2]));

		r = Math.min(255, r);
		b = Math.min(255, b);
		g = Math.min(255, g);
		return (r << 16) | (g << 8) | b;
	}