Skip to content

Instantly share code, notes, and snippets.

@IT-Delinquent
Last active October 12, 2022 10:21
Embed
What would you like to do?
garminBatteryIndicatorLabelColor.mc
//Update the battery text color
function updateBatteryTextColor(updateBatPerc){
var _color = Graphics.COLOR_GREEN;
//Setting battery label color based on percentage
if (updateBatPerc > 75){
_color = Graphics.COLOR_DK_GREEN;
}
if (updateBatPerc < 75 && updateBatPerc >= 25){
_color = Graphics.COLOR_YELLOW;
}
if (updateBatPerc < 25){
_color = Graphics.COLOR_RED;
}
var _viewObject = View.findDrawableById("BatteryLabel");
_viewObject.setColor(_color);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment