The Battery Tile layout supports this natively.

To use the Battery Tile layout, tap the ... in the top-right corner of your tile (while editing your dashboard), then choose Change Layout and then choose the Battery Tile option.

Then you can tap the ... in the top-right corner of the tile and choose Edit where you’ll see the settings for customizing the thresholds.

There’s also a feature request open for being able to set custom thresholds for mapping tile styles in the Hero Attribute tile which you can vote on here: