Color parsing and management for matplotlib-compatible color syntax
Supports: - Hex colors: #FF0000, #F00 - 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
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=wp), | public | :: | r | = | 0.0_wp | ||
real(kind=wp), | public | :: | g | = | 0.0_wp | ||
real(kind=wp), | public | :: | b | = | 0.0_wp | ||
real(kind=wp), | public | :: | a | = | 1.0_wp | ||
logical, | public | :: | valid | = | .false. |
Check if color string is valid without full parsing
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | color_str |
Get cache hit rate for performance monitoring
Validate color for specific backend constraints
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | color_str | |||
character(len=*), | intent(in) | :: | backend |
Parse matplotlib-compatible color string to RGB values [0,1]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | color_str | |||
real(kind=wp), | intent(out) | :: | rgb(3) | |||
logical, | intent(out) | :: | success |
Parse color string to RGBA values [0,1] including alpha channel
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | color_str | |||
real(kind=wp), | intent(out) | :: | rgba(4) | |||
logical, | intent(out) | :: | success |
Clear the color cache
Parse multiple colors efficiently
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | color_specs(:) | |||
real(kind=wp), | intent(out) | :: | rgb_results(:,:) | |||
logical, | intent(out) | :: | success_flags(:) |
Convert RGB to HSV color space
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | rgb(3) | |||
real(kind=wp), | intent(out) | :: | hsv(3) |
Convert RGB to LAB color space (simplified implementation)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | rgb(3) | |||
real(kind=wp), | intent(out) | :: | lab(3) |
Apply colormap to array of values efficiently
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | values(:) | |||
character(len=*), | intent(in) | :: | colormap | |||
real(kind=wp), | intent(out) | :: | rgb_mapped(:,:) |