import io


def export_sass(palette):
    """
    Return a string of Sass variable for every colors.

    Arguments:
        palette (dict): Dictionnary of named colors (as dumped in JSON from
            ``colors`` command)

    Returns:
        string: Sass variables.
    """
    # Sass color palette variable
    sass_palette = io.StringIO()

    for original_code, values in sorted(palette.items(), key=lambda x:x[1]):
        name, from_color = values
        sass_palette.write('${}: {};\n'.format(name, original_code))

    output = sass_palette.getvalue()

    sass_palette.close()

    return output