### ===================================================================================================================
### FUNCTION: Get legend colours for VIIA pictures
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from typing import Tuple
### ===================================================================================================================
### 2. Function to get the legend colours for result pictures
### ===================================================================================================================
[docs]def viia_get_legend_colours(
pic_type: str, critical_boundary_colour: str = '#ff0000', non_critical_boundary_colour: str = '#0000ff') -> \
Tuple[str, str]:
"""
This function sets the upper-bound and lower-bound colours.
Input:
- pic_type (str): The result type of the result picture, this is defined in the viia-result_pictures yaml
file. Used to check for maximum or minimum critical boundary (or crackwidth).
- critical_boundary_colour (str): The colour to be used for the critical boundary. Default value '#ff0000'.
- non_critical_boundary_colour (str): The colour to be used for the non-critical boundary. Default value
'#0000ff'.
Output:
- Returns the order to be used in the legend of the boundary colours. Returns list of two strings.
"""
if any(['max' in pic_type.lower(), 'crackwidth' in pic_type.lower()]):
return critical_boundary_colour, non_critical_boundary_colour
elif 'min' in pic_type.lower():
return non_critical_boundary_colour, critical_boundary_colour
raise ValueError(
f"ERROR: The picture type of {pic_type} is neither the result of maximum or minimum, the legend boundary "
f"colours cannot be decided in this case.")
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================