import pathlib

import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
from PIL import Image

_colorway = px.colors.qualitative.G10
_colorway[2] = '#FBAA36'
_colorway[5] = '#00A7B5'

logo_path = pathlib.Path(__file__).parent / 'vaxa_analytics_plot_logo.png'

# noinspection PyTypeChecker
VaxaBrandingTemplate = go.layout.Template(
    layout=go.Layout(
        title_font=dict(family="Darker Grotesque", size=36),
        width=1200,
        height=800,
        font=dict(family="Plus Jakarta Sans", size=14),
        colorway=_colorway,
        yaxis_automargin='left+top',
        xaxis_automargin='left+right',
        margin=dict(b=100, pad=10),
        images=[
            dict(
                name='logo',
                source=Image.open(logo_path),
                xref="paper", yref="paper",
                x=-0.05, y=-0.1,
                sizex=0.4, sizey=0.4,
                xanchor="left", yanchor="top"
            )
        ],

        # legend settings
        showlegend=True,
        legend_title="Legend",
        legend_bgcolor = 'rgba(230,231,232,0.5)'
    ),
)
pio.templates["vaxa_analytics"] = VaxaBrandingTemplate