Skip to content

Instantly share code, notes, and snippets.

@IT-Delinquent
Last active October 12, 2022 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IT-Delinquent/35fafbbe4a46291753c12476dc932b86 to your computer and use it in GitHub Desktop.
Save IT-Delinquent/35fafbbe4a46291753c12476dc932b86 to your computer and use it in GitHub Desktop.
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