mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Modify IdenticonBase to use a dark background for light identicons
This commit is contained in:
@@ -51,13 +51,14 @@ public abstract class IdenticonBase {
|
|||||||
protected void setupColors() {
|
protected void setupColors() {
|
||||||
mColors = new int[mRowCount][mColumnCount];
|
mColors = new int[mRowCount][mColumnCount];
|
||||||
int colorVisible = getIconColor();
|
int colorVisible = getIconColor();
|
||||||
|
int colorInvisible = getBackgroundColor();
|
||||||
|
|
||||||
for (int r = 0; r < mRowCount; r++) {
|
for (int r = 0; r < mRowCount; r++) {
|
||||||
for (int c = 0; c < mColumnCount; c++) {
|
for (int c = 0; c < mColumnCount; c++) {
|
||||||
if (isCellVisible(r, c)) {
|
if (isCellVisible(r, c)) {
|
||||||
mColors[r][c] = colorVisible;
|
mColors[r][c] = colorVisible;
|
||||||
} else {
|
} else {
|
||||||
mColors[r][c] = Color.TRANSPARENT;
|
mColors[r][c] = colorInvisible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,6 +95,15 @@ public abstract class IdenticonBase {
|
|||||||
|
|
||||||
abstract protected int getIconColor();
|
abstract protected int getIconColor();
|
||||||
|
|
||||||
|
protected int getBackgroundColor() {
|
||||||
|
float[] hsv = new float[3];
|
||||||
|
Color.colorToHSV(getIconColor(), hsv);
|
||||||
|
if (hsv[2] < 0.5)
|
||||||
|
return Color.parseColor("#ffeeeeee"); // @color/background_material_light
|
||||||
|
else
|
||||||
|
return Color.parseColor("#ff303030"); // @color/background_material_dark
|
||||||
|
}
|
||||||
|
|
||||||
public void updateSize(int w, int h) {
|
public void updateSize(int w, int h) {
|
||||||
mCellWidth = w / mColumnCount;
|
mCellWidth = w / mColumnCount;
|
||||||
mCellHeight = h / mRowCount;
|
mCellHeight = h / mRowCount;
|
||||||
|
|||||||
Reference in New Issue
Block a user