def resolve_var(computed, token, parent_style):
    """Return token with resolved CSS variables."""
    if not check_var_function(token):
        return

    if token.lower_name != 'var':
        arguments = []
        for i, argument in enumerate(token.arguments):
            if argument.type == 'function':
                arguments.extend(resolve_var(computed, argument, parent_style))
            else:
                arguments.append(argument)
        token = tinycss2.ast.FunctionBlock(
            token.source_line, token.source_column, token.name, arguments)
        return resolve_var(computed, token, parent_style) or (token,)

    args = parse_function(token)[1]
    variable_name = args.pop(0).value.replace('-', '_')  # first arg is name
    default = args  # next args are default value
    computed_value = []
    for value in (computed[variable_name] or default):
        resolved = resolve_var(computed, value, parent_style)
        computed_value.extend((value,) if resolved is None else resolved)
    return computed_value
Return token with resolved CSS variables.
weasyprint/css/__init__.py