paint tilemap through code

Hello there

I want to make a game where the player moves through a tilemap and paints it a solid color as they go. How can I do it?

just make a tilemap full of that color
and use this code

public Tilemap tilemap; //set you player's tilemap here
public Transform player; //put your player gameObject here

void Update() {
    Vector3Int playerPosition = tilemap.WorldToCell(player.position);
    tilemap.SetTile(playerPosition, null);
}