Analysis Functions

Available functions:

  • get_temperature(rgb): Determine the temperature of a color based on its RGB values.

  • is_neutral(rgb): Check if a color is neutral.

  • brightness(rgb): Calculate the brightness of a color.

  • is_pastel(rgb): Check if a color is pastel.

  • is_muted(rgb): Check if a color is muted.

  • is_vibrant(rgb): Check if a color is vibrant.

  • rgb_to_linear(rgb): Convert RGB values to linear RGB.

  • get_luminance(rgb): Calculate the relative luminance of an RGB color.

  • get_vibrancy(rgb): Calculate the vibrancy of an RGB color.

  • color_contrast(color1, color2): Calculates the contrast ratio between two colors using their RGB values.

  • get_text_color_from_background(background_color): Determines whether the text should be "light" or "dark" based on the background color.

  • check_color_quality(rgb): Evaluates if a color is of 'good quality' for UI/text usage.

  • simulate_color_blindness(rgb, blindness_type="protanopia", intensity=1.0): Simulates color blindness on a given RGB color.


Get temperature

Determine the temperature of a color based on its RGB values.

Is neutral

Check if a color is neutral.

Brightness

Calculate the brightness of a color.

Is pastel

Check if a color is pastel.

Is muted

Check if a color is muted.

Is vibrant

Check if a color is vibrant.

RGB to linear

Convert RGB values to linear RGB.

Get luminance

Calculate the relative luminance of an RGB color.

Get vibrancy

Calculate the vibrancy of an RGB color.

Color contrast

Calculate the vibrancy of an RGB color.

Get text color from background

Determines whether the text should be "light" or "dark" based on the background color.

Check color quality

Evaluates if a color is of 'good quality' for UI/text usage.

This function simulates a color visibility tester by checking the color's contrast ratio against standard black and white backgrounds. A color is considered 'good quality' if it meets the WCAG AA standard (contrast ratio >= 4.5) against at least one of the backgrounds.

Simulate color blindness

Simulates color blindness on a given RGB color.

Last updated