Hi Clover Dev,
Is it possible to get the colour that each item uses in the register app.
Can I get it from the API or is there some algorithm clover uses?
(Not an urgent issue!)
Thanks
The color we use is an implementation detail and is subject to change at any point.
mGroupUuidColumnIndex = newCursor.getColumnIndex(InventoryContract.Item.ITEM_GROUP_UUID);
mUuidColumnIndex = newCursor.getColumnIndex(InventoryContract.Item.UUID);
...
String itemId = cursor.getString(mUuidColumnIndex);
String groupId = cursor.getString(mGroupUuidColumnIndex);
String seed = isGroup ? groupId : itemId;
if (!TextUtils.isEmpty(seed)) {
random.setSeed(seed.hashCode());
vc.colorGroup.setBackgroundColor(Color.argb(180, random.nextInt(128), random.nextInt(128), random.nextInt(128)));
}
Basically, seeding with a per-item (or group) constant, then picking a color at "random".
1 Person is following this question.