Change Background Color of Valuetile Depending on String Value

I have a value tile that shows if a door is “open” or “closed”. I would like the tile background color to change based on the value: open or closed. The below code is from the smartthings docs. However, my values are strings not integers. Any help how I can adapt this, or some other method, to change background colors based on string values?

valueTile("temperature", "device.temperature", width: 2, height: 2) {
    state("temperature", label:'${currentValue}', unit:"dF",
        backgroundColors:[
            [value: 31, color: "#153591"],
            [value: 44, color: "#1e9cbb"],
            [value: 59, color: "#90d2a7"],
            [value: 74, color: "#44b621"],
            [value: 84, color: "#f1d801"],
            [value: 95, color: "#d04e00"],
            [value: 96, color: "#bc2323"]
        ]
    )
}

Thanks!

It would look a little like this:

    standardTile("menuButton", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
      state "closed", label: 'push', backgroundColor:"#ffffff"
      state "open", label: 'push', backgroundColor:"#00a0dc"
    }

I am using sendevent() to pass the value “open” or “closed” to the value tile. Will that work using a standard tile? How will the standard tile receive the event? I’m seeing how the tile will know whether to go to the closed or open state based on the value sent.

The piece which displays the colour, is this:

      state "closed", label: 'push', backgroundColor:"#ffffff"
      state "open", label: 'push', backgroundColor:"#00a0dc"

… and you can put that inside a valueTile or a standardTile.

Somewhere in your code, you’d need to define the attribute to hold the open and closed values. That might be a custom attribute or one that’s provided by a capability, like the Door Control capability http://docs.smartthings.com/en/latest/capabilities-reference.html#id56

capability "Door"

        valueTile("yourName", "device.door", decoration: "flat", width: 2, height: 2) {
          state "closed", backgroundColor:"#ffffff"
          state "open", backgroundColor:"#00a0dc"
        }

sendEvent(name: "door", value: "open")

… or

attribute "myCustomDoorAttribute", "string"

sendEvent(name: "myCustomDoorAttribute", value: "open")

        valueTile("yourName", "device.myCustomDoorAttribute", decoration: "flat", width: 2, height: 2) {
          state "closed", backgroundColor:"#ffffff"
          state "open", backgroundColor:"#00a0dc"
        }

I’m not sure how much code you already have. If that doesn’t make sense, feel free to share the code and I can point out the steps required to hook it all up.