|
"""Configuration et constantes pour les graphiques"""
|
|
|
|
|
|
COLORS = {
|
|
'primary': '#CC0C13',
|
|
'secondary': '#000000',
|
|
'white': '#FFFFFF',
|
|
'light_red': 'rgba(204, 12, 19, 0.2)',
|
|
'gray': '#666666'
|
|
}
|
|
|
|
|
|
COLORSCALE = [[0, COLORS['secondary']], [1, COLORS['primary']]]
|
|
|
|
|
|
COLORSCALE_HEATMAP = [[0, COLORS['white']], [1, COLORS['primary']]]
|
|
|
|
|
|
COLORSCALE_REVERSED = [[0, COLORS['primary']], [1, COLORS['white']]]
|
|
|
|
|
|
DISCRETE_COLORS = [COLORS['primary'], COLORS['secondary'], COLORS['white'], COLORS['gray']]
|
|
|
|
|
|
BASE_LAYOUT = {
|
|
'plot_bgcolor': 'rgba(248, 249, 250, 0.5)',
|
|
'paper_bgcolor': 'rgba(0,0,0,0)',
|
|
'font': dict(family='Arial', color=COLORS['secondary'], size=11)
|
|
}
|
|
|
|
def remove_colorscale_legend(fig):
|
|
"""Fonction utilitaire pour enlever la colorscale de n'importe quel graphique"""
|
|
fig.update_traces(showscale=False)
|
|
return fig
|
|
|
|
def apply_stade_style(fig, title=None, remove_colorbar=True):
|
|
"""Applique le style Stade Toulousain avec option pour enlever la colorbar"""
|
|
|
|
if remove_colorbar:
|
|
fig.update_traces(showscale=False)
|
|
|
|
fig.update_layout(
|
|
**BASE_LAYOUT,
|
|
title={
|
|
'text': title,
|
|
'font': dict(color=COLORS['primary'], size=16, family='Arial Black'),
|
|
'x': 0.5,
|
|
'xanchor': 'center'
|
|
} if title else None
|
|
)
|
|
|
|
return fig |