krakentools.plotting.get_optimal_text_color

krakentools.plotting.get_optimal_text_color(bg_color, threshold=120)

Returns “k” or “w” for text color based on background rgba color (quartet of floats in [0, 1])

Parameters:
  • bg_color (Tuple[float, float, float, float]) – (Tuple[float, float, float, float]): Background color as a (r, g, b, a) quartet (all between zero and one).

  • threshold (int) – Threshold between black and white text. Larger thresholds give more black, smaller thresholds give more white text, defaults to 120

Return type:

str

Returns:

“k” or “w”