Lines Matching refs:Color
19 import android.graphics.Color;
32 * {@link R.color#car_tint_light} and
33 * {@link R.color#car_tint_dark}
36 int lightTintColor = context.getResources().getColor(R.color.car_tint_light);
37 int darkTintColor = context.getResources().getColor(R.color.car_tint_dark);
44 * {@link R.color#car_tint_light} and
45 * {@link R.color#car_tint_dark}
48 int lightTintColor = context.getResources().getColor(R.color.car_tint_light);
49 int darkTintColor = context.getResources().getColor(R.color.car_tint_dark);
70 * Determines what color to tint icons given the background color that they sit on.
73 * @param bgColor The background color that the icons sit on.
75 * @return The color that the icons should be tinted. Will be the first tinted color that
86 double blackContrastRatio = getContrastRatio(bgColor, Color.BLACK);
87 double whiteContrastRatio = getContrastRatio(bgColor, Color.WHITE);
89 Log.w(TAG, "Tint color does not meet contrast requirements. Using white.");
90 return Color.WHITE;
92 Log.w(TAG, "Tint color does not meet contrast requirements. Using black.");
93 return Color.BLACK;
107 * Calculates the luminance of a color as specified by:
110 * @param color The color to calculate the luminance of.
113 public static double getLuminance(int color) {
115 double r = convert8BitToLuminanceComponent(Color.red(color));
116 double g = convert8BitToLuminanceComponent(Color.green(color));
117 double b = convert8BitToLuminanceComponent(Color.blue(color));
122 * Converts am 8 bit color component (0-255) to the luminance component as specified by: