def color_amount(accel_component):
    """Convert acceleration component (x, y, or z) to color amount (r, g, or b)"""
    standard_gravity = 9.81  # Acceleration (m/s²) due to gravity at the earth’s surface
    accel_magnitude = abs(accel_component)  # Ignore the direction
    constrained_accel = min(accel_magnitude, standard_gravity)  # Constrain values
    normalized_accel = constrained_accel / standard_gravity  # Convert to 0–1
    return round(normalized_accel * 255)