{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/figma/json-schema/figma-variable-mode-value-schema.json",
  "title": "VariableModeValue",
  "description": "An object that represents a value for a given mode of a variable. All properties are required.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/figma-variables-api-openapi.yml#/components/schemas/VariableModeValue",
  "type": "object",
  "properties": {
    "variableId": {
      "type": "string",
      "description": "The target variable. You can use the temporary id of a variable."
    },
    "modeId": {
      "type": "string",
      "description": "Must correspond to a mode in the variable collection that contains the target variable."
    },
    "value": {
      "$ref": "#/$defs/VariableValue"
    }
  },
  "required": [
    "variableId",
    "modeId",
    "value"
  ],
  "$defs": {
    "RGB": {
      "type": "object",
      "description": "An RGB color",
      "properties": {
        "r": {
          "type": "number",
          "description": "Red channel value, between 0 and 1.",
          "minimum": 0,
          "maximum": 1
        },
        "g": {
          "type": "number",
          "description": "Green channel value, between 0 and 1.",
          "minimum": 0,
          "maximum": 1
        },
        "b": {
          "type": "number",
          "description": "Blue channel value, between 0 and 1.",
          "minimum": 0,
          "maximum": 1
        }
      },
      "required": [
        "r",
        "g",
        "b"
      ]
    },
    "RGBA": {
      "type": "object",
      "description": "An RGBA color",
      "properties": {
        "r": {
          "type": "number",
          "description": "Red channel value, between 0 and 1.",
          "minimum": 0,
          "maximum": 1
        },
        "g": {
          "type": "number",
          "description": "Green channel value, between 0 and 1.",
          "minimum": 0,
          "maximum": 1
        },
        "b": {
          "type": "number",
          "description": "Blue channel value, between 0 and 1.",
          "minimum": 0,
          "maximum": 1
        },
        "a": {
          "type": "number",
          "description": "Alpha channel value, between 0 and 1.",
          "minimum": 0,
          "maximum": 1
        }
      },
      "required": [
        "r",
        "g",
        "b",
        "a"
      ]
    },
    "VariableAlias": {
      "type": "object",
      "description": "Contains a variable alias",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "VARIABLE_ALIAS"
          ]
        },
        "id": {
          "type": "string",
          "description": "The id of the variable that the current variable is aliased to. This variable can be a local or remote variable, and both can be retrieved via the GET /v1/files/:file_key/variables/local endpoint."
        }
      },
      "required": [
        "type",
        "id"
      ]
    },
    "VariableComposedColor": {
      "description": "A color with an independently authored opacity.",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "color": {
              "oneOf": [
                {
                  "$ref": "#/$defs/RGB"
                },
                {
                  "$ref": "#/$defs/RGBA"
                }
              ]
            },
            "opacity": {
              "$ref": "#/$defs/VariableAlias"
            }
          },
          "required": [
            "color",
            "opacity"
          ]
        },
        {
          "type": "object",
          "properties": {
            "color": {
              "$ref": "#/$defs/VariableAlias"
            },
            "opacity": {
              "oneOf": [
                {
                  "type": "number"
                },
                {
                  "$ref": "#/$defs/VariableAlias"
                }
              ]
            }
          },
          "required": [
            "color",
            "opacity"
          ]
        }
      ]
    },
    "VariableValue": {
      "description": "The value for the variable. The value must match the variable's type. If setting to a variable alias, the alias must resolve to this type. If overriding a value, the value type must match the variable's type. If removing an overridden value, the value must be `null`.",
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "number"
        },
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/RGB"
        },
        {
          "$ref": "#/$defs/RGBA"
        },
        {
          "$ref": "#/$defs/VariableAlias"
        },
        {
          "$ref": "#/$defs/VariableComposedColor"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}