Android color picker to be included in the activity

Your class should implement ColorPickerDialog.OnColorChangedListener public class MainActivity implements ColorPickerDialog.OnColorChangedListener { private Paint mPaint; mPaint = new Paint(); // on button click new ColorPickerDialog(this, this, mPaint.getColor()).show(); } ColorPicker Dialog public class ColorPickerDialog extends Dialog { public interface OnColorChangedListener { void colorChanged(int color); } private OnColorChangedListener mListener; private int mInitialColor; private static class ColorPickerView extends View … Read more

Converting RGB to HSB Colors

Maybe you already look into this wikipedia article, but to make it clear. There is a difference between HSL and HSB (aka HSV). So you can’t take the (B)rightness from the color class and use it like a (L)uminosity. To get back from the Color class provided values GetHue(), GetSaturation() and GetBrightness() to a normal … Read more

Chart.js Line, different fill color for negative point

You can extend the line chart to do this. Preview Script Chart.defaults.NegativeTransparentLine = Chart.helpers.clone(Chart.defaults.line); Chart.controllers.NegativeTransparentLine = Chart.controllers.line.extend({ update: function () { // get the min and max values var min = Math.min.apply(null, this.chart.data.datasets[0].data); var max = Math.max.apply(null, this.chart.data.datasets[0].data); var yScale = this.getScaleForId(this.getDataset().yAxisID); // figure out the pixels for these and the value 0 var top … Read more

How to change alert dialog header divider color android

You can actually change color of AlertDialog title by a very simple hack: public static void brandAlertDialog(AlertDialog dialog) { try { Resources resources = dialog.getContext().getResources(); int color = resources.getColor(…); // your color here int alertTitleId = resources.getIdentifier(“alertTitle”, “id”, “android”); TextView alertTitle = (TextView) dialog.getWindow().getDecorView().findViewById(alertTitleId); alertTitle.setTextColor(color); // change title text color int titleDividerId = resources.getIdentifier(“titleDivider”, “id”, … Read more

“Distance” between colours in PHP

Each color is represented as a tuple in the HEX code. To determine close matches you need to subtract each RGB component separately. Example: Color 1: #112233 Color 2: #122334 Color 3: #000000 Difference between color1 and color2: R=1, G=1 B=1 = 0x3 Difference between color3 and color1: R=11, G=22, B=33 = 0x66 So color … Read more