81 lines
2.3 KiB
Python
81 lines
2.3 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"
|
|
|
|
|
|
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
|