def darken_color(c):
    """
    Darken a color.

    Small utility function to compute the color for the border of
    the problem name badges.

    When no color is passed, a dark border is set.
    """
    if not c:
        return '#000'  # black
    r, g, b = int(c[1:3], 16), int(c[3:5], 16), int(c[5:], 16)
    return '#{:0>6s}'.format(
        hex(int(r * 0.5) << 16 | int(g * 0.5) << 8 | int(b * 0.5))[2:])