Darkens a color by reducing its RGB channel values.

@param context the current context
@param res     the color resource
@param percent the percent to decrease
@return a color int
339134
@ColorInt public static int decreaseRgbChannels(Context context,
                                                    @ColorRes int res, float percent) {
        int c = resolveColor(res, context);

        // reduce rgb channel values to produce box shadow effect
        int red = (Color.red(c));
        red -= (red * percent);
        red = red > 0 ? red : 0;

        int green = (Color.green(c));
        green -= (green * percent);
        green = green > 0 ? green : 0;

        int blue = (Color.blue(c));
        blue -= (blue * percent);
        blue = blue > 0 ? blue : 0;

        return Color.argb(Color.alpha(c), red, green, blue);
    }
966824
protected int getSelectedTextColor(Context ctx) {
        return ColorHolder.color(getSelectedTextColor(), ctx, R.attr.material_drawer_selected_text, R.color.material_drawer_selected_text);
    }
903240
@CheckReturnValue
    public RoleAction setColor(Color color)
    {
        return this.setColor(color != null ? color.getRGB() : null);
    }
683317
public static boolean isDarkTheme(Context context, boolean current) {
        return resolveBoolean(context, R.attr.mdtp_theme_dark, current);
    }
174824
public void setAverageColor(final Color COLOR) {
        if (null == averageColor) {
            _averageColor = COLOR;
            fireUpdateEvent(REDRAW_EVENT);
        } else {
            averageColor.set(COLOR);
        }
    }
1102440
function (ui, context) {
					if (context != colorMap) {
						switch (settings.color.mode) {
						case 'h':
							var sv = ui.val('sv');
							colorMap.val('xy', {
								x: sv != null ? sv.s : 100,
								y: 100 - (sv != null ? sv.v : 100)
							}, context);
							break;
						case 's':
						case 'a':
							var hv = ui.val('hv');
							colorMap.val('xy', {
								x: hv && hv.h || 0,
								y: 100 - (hv != null ? hv.v : 100)
							}, context);
							break;
						case 'v':
							var hs = ui.val('hs');
							colorMap.val('xy', {
								x: hs && hs.h || 0,
								y: 100 - (hs != null ? hs.s : 100)
							}, context);
							break;
						case 'r':
							var bg = ui.val('bg');
							colorMap.val('xy', {
								x: bg && bg.b || 0,
								y: 255 - (bg && bg.g || 0)
							}, context);
							break;
						case 'g':
							var br = ui.val('br');
							colorMap.val('xy', {
								x: br && br.b || 0,
								y: 255 - (br && br.r || 0)
							}, context);
							break;
						case 'b':
							var rg = ui.val('rg');
							colorMap.val('xy', {
								x: rg && rg.r || 0,
								y: 255 - (rg && rg.g || 0)
							}, context);
							break;
						}
					}
					if (context != colorBar) {
						switch (settings.color.mode) {
						case 'h':
							colorBar.val('y', 360 - (ui.val('h') || 0), context);
							break;
						case 's':
							var s = ui.val('s');
							colorBar.val('y', 100 - (s != null ? s : 100), context);
							break;
						case 'v':
							var v = ui.val('v');
							colorBar.val('y', 100 - (v != null ? v : 100), context);
							break;
						case 'r':
							colorBar.val('y', 255 - (ui.val('r') || 0), context);
							break;
						case 'g':
							colorBar.val('y', 255 - (ui.val('g') || 0), context);
							break;
						case 'b':
							colorBar.val('y', 255 - (ui.val('b') || 0), context);
							break;
						case 'a':
							var a = ui.val('a');
							colorBar.val('y', 255 - (a != null ? a : 255), context);
							break;
						}
					}
				}
1016683
@NonNull
    public IconicsDrawable colorRes(@ColorRes int colorResId) {
        return color(ContextCompat.getColor(mContext, colorResId));
    }
1339036
@NonNull
    public IconicsDrawable backgroundColorRes(@ColorRes int colorResId) {
        return backgroundColor(ContextCompat.getColor(mContext, colorResId));
    }
476447
public void setHighlightColor(final Color COLOR) {
        if (null == highlightColor) {
            _highlightColor = COLOR;
            fireSectionEvent(UPDATE_EVENT);
        } else {
            highlightColor.set(COLOR);
        }
    }
1281033
public static int getColorAttr(Context ctx, @AttrRes int colorAttrId){
        int[] attrs = new int[] { colorAttrId /* index 0 */};
        TypedArray ta = ctx.obtainStyledAttributes(attrs);
        int colorFromTheme = ta.getColor(0, 0);
        ta.recycle();
        return colorFromTheme;
    }
790367
public static int convertDPItoPixels(Context context, int dpi) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dpi * scale + 0.5f);
    }
947878
private Color variate(Color color) {
		assert color != null;
		final int diff = 30;
		// darken the color for value of diff
		int newRed = shiftColorPart(color.getRed() - diff);
		int newGreen = shiftColorPart(color.getGreen() - diff);
		int newBlue = shiftColorPart(color.getBlue() - diff);
		Color newColor = new Color(newRed, newGreen, newBlue);
		// start at the original section color again if darkening accidentally
		// resulted in black, which has already the meaning of section caves.
		if (newColor.equals(Color.black)) {
			newColor = colorMap.get(SECTION_START);
		}
		return newColor;
	}
974467
function (ui, context) {
					var hex = ui.val('hex');
					currentPreview.css({
						backgroundColor: hex && '#' + hex || 'transparent'
					});
					setAlpha.call($this, currentPreview, mPrecision(((ui.val('a') || 0) * 100) / 255, 4));
				}
156522
public void setAccentColor(@ColorInt int color) {
        mAccentColor = Color.argb(255, Color.red(color), Color.green(color), Color.blue(color));
    }
1095737
protected int getSelectedColor(Context ctx) {
        if (getBooleanStyleable(ctx, R.styleable.MaterialDrawer_material_drawer_legacy_style, false)) {
            return ColorHolder.color(getSelectedColor(), ctx, R.attr.material_drawer_selected_legacy, R.color.material_drawer_selected_legacy);
        } else {
            return ColorHolder.color(getSelectedColor(), ctx, R.attr.material_drawer_selected, R.color.material_drawer_selected);
        }
    }
1011188
public static int color(ColorHolder colorHolder, Context ctx) {
        if (colorHolder == null) {
            return 0;
        } else {
            return colorHolder.color(ctx);
        }
    }
123576
public void setBrightTextColor(final Color COLOR) {
        if (null == brightTextColor) {
            _brightTextColor = COLOR;
            if (isAutoTextColor()) {
                adjustTextColors();
                redraw();
            }
        } else {
            brightTextColor.set(COLOR);
        }
    }