Files
JPMC-quant/theme.py

95 lines
2.8 KiB
Python

"""
Color palette and style definitions for Voice Branding analysis plots.
"""
class ColorPalette:
"""
Consistent color palette for all visualizations.
Update colors here to propagate changes to all plots.
"""
# Primary brand/chart color
PRIMARY = "#0077B6" # Medium Blue
# Gradient for rankings (Darkest -> Lightest or Strong -> Soft)
RANK_1 = "#004C6D" # Dark Blue (1st Choice)
RANK_2 = "#008493" # Teal (2nd Choice)
RANK_3 = "#5AAE95" # Sea Green (3rd Choice)
RANK_4 = "#9E9E9E" # Grey (4th Choice / Worst)
# Neutral color for unhighlighted comparison items
NEUTRAL = "#D3D3D3" # Light Grey
# General UI elements
TEXT = "black"
GRID = "lightgray"
BACKGROUND = "white"
# Extended palette for categorical charts (e.g., pie charts with many categories)
CATEGORICAL = [
"#0077B6", # PRIMARY - Medium Blue
"#004C6D", # RANK_1 - Dark Blue
"#008493", # RANK_2 - Teal
"#5AAE95", # RANK_3 - Sea Green
"#9E9E9E", # RANK_4 - Grey
"#D3D3D3", # NEUTRAL - Light Grey
"#003049", # Dark Navy
"#669BBC", # Light Steel Blue
"#A8DADC", # Pale Cyan
"#457B9D", # Steel Blue
]
def jpmc_altair_theme():
"""JPMC brand theme for Altair charts."""
return {
'config': {
'view': {
'continuousWidth': 1000,
'continuousHeight': 500,
'strokeWidth': 0
},
'background': ColorPalette.BACKGROUND,
'axis': {
'grid': True,
'gridColor': ColorPalette.GRID,
'labelFontSize': 11,
'titleFontSize': 12,
'labelColor': ColorPalette.TEXT,
'titleColor': ColorPalette.TEXT,
'labelLimit': 200 # Allow longer labels before truncation
},
'axisX': {
'labelAngle': -45,
'labelLimit': 200 # Allow longer x-axis labels
},
'axisY': {
'labelAngle': 0
},
'legend': {
'orient': 'top',
'direction': 'horizontal',
'titleFontSize': 11,
'labelFontSize': 11
},
'title': {
'fontSize': 14,
'color': ColorPalette.TEXT,
'anchor': 'start',
'subtitleFontSize': 10,
'subtitleColor': 'gray'
},
'bar': {
'color': ColorPalette.PRIMARY
}
}
}
# Register Altair theme
try:
import altair as alt
alt.themes.register('jpmc', jpmc_altair_theme)
alt.themes.enable('jpmc')
except ImportError:
pass # Altair not installed