fortplot_color_parsing Module

Core color parsing functionality for matplotlib-compatible color syntax

Supports: - Hex colors: #FF0000, #F00, #FF000080 - RGB tuples: (1.0, 0.5, 0.0), (255, 128, 0) - Named colors: red, blue, green, etc. - Single letters: r, g, b, c, m, y, k, w - RGBA with alpha channel support - Performance optimization through caching



Functions

public function is_valid_color(color_str) result(is_valid)

Check if color string is valid without full parsing

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: color_str

Return Value logical

public function get_cache_hit_rate() result(hit_rate)

Get cache hit rate for performance monitoring

Arguments

None

Return Value real(kind=wp)

public function validate_color_for_backend(color_str, backend) result(is_valid)

Validate color for specific backend constraints

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: color_str
character(len=*), intent(in) :: backend

Return Value logical


Subroutines

public subroutine parse_color(color_str, rgb, success)

Parse matplotlib-compatible color string to RGB values [0,1]

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: color_str
real(kind=wp), intent(out) :: rgb(3)
logical, intent(out) :: success

public subroutine parse_color_rgba(color_str, rgba, success)

Parse color string to RGBA values [0,1] including alpha channel

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: color_str
real(kind=wp), intent(out) :: rgba(4)
logical, intent(out) :: success

public subroutine clear_color_cache()

Clear the color cache

Arguments

None

public subroutine parse_colors_bulk(color_specs, rgb_results, success_flags)

Parse multiple colors efficiently

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: color_specs(:)
real(kind=wp), intent(out) :: rgb_results(:,:)
logical, intent(out) :: success_flags(:)