Add theme color support via instance.yaml
Allow instances to override primary CSS color variables through theme section in instance.yaml config.
This commit is contained in:
parent
e35e602c59
commit
954aa0f17e
3 changed files with 23 additions and 0 deletions
|
|
@ -107,6 +107,11 @@ class Config:
|
||||||
INSTANCE_SUBTITLE = _get(_instance, "instance", "subtitle", default="")
|
INSTANCE_SUBTITLE = _get(_instance, "instance", "subtitle", default="")
|
||||||
INSTANCE_COPYRIGHT = _get(_instance, "instance", "copyright", default="")
|
INSTANCE_COPYRIGHT = _get(_instance, "instance", "copyright", default="")
|
||||||
|
|
||||||
|
# Theme colors (optional overrides from instance config)
|
||||||
|
THEME_PRIMARY = _get(_instance, "theme", "primary", default="")
|
||||||
|
THEME_PRIMARY_DARK = _get(_instance, "theme", "primary_dark", default="")
|
||||||
|
THEME_PRIMARY_LIGHT = _get(_instance, "theme", "primary_light", default="")
|
||||||
|
|
||||||
# Telegram bot
|
# Telegram bot
|
||||||
TELEGRAM_BOT_USERNAME = _get(_instance, "telegram", "bot_username", default="")
|
TELEGRAM_BOT_USERNAME = _get(_instance, "telegram", "bot_username", default="")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,15 @@
|
||||||
<title>{% block title %}Data Analyst Portal{% endblock %}</title>
|
<title>{% block title %}Data Analyst Portal{% endblock %}</title>
|
||||||
<link rel="stylesheet" href="{{ static_url('style.css') }}">
|
<link rel="stylesheet" href="{{ static_url('style.css') }}">
|
||||||
<link rel="stylesheet" href="{{ static_url('style-custom.css') }}">
|
<link rel="stylesheet" href="{{ static_url('style-custom.css') }}">
|
||||||
|
{% if config.THEME_PRIMARY %}
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--primary: {{ config.THEME_PRIMARY }};
|
||||||
|
{% if config.THEME_PRIMARY_DARK %}--primary-dark: {{ config.THEME_PRIMARY_DARK }};{% endif %}
|
||||||
|
{% if config.THEME_PRIMARY_LIGHT %}--primary-light: {{ config.THEME_PRIMARY_LIGHT }};{% endif %}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endif %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,15 @@
|
||||||
<title>{% block title %}Data Analyst Portal{% endblock %}</title>
|
<title>{% block title %}Data Analyst Portal{% endblock %}</title>
|
||||||
<link rel="stylesheet" href="{{ static_url('style.css') }}">
|
<link rel="stylesheet" href="{{ static_url('style.css') }}">
|
||||||
<link rel="stylesheet" href="{{ static_url('style-custom.css') }}">
|
<link rel="stylesheet" href="{{ static_url('style-custom.css') }}">
|
||||||
|
{% if config.THEME_PRIMARY %}
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--primary: {{ config.THEME_PRIMARY }};
|
||||||
|
{% if config.THEME_PRIMARY_DARK %}--primary-dark: {{ config.THEME_PRIMARY_DARK }};{% endif %}
|
||||||
|
{% if config.THEME_PRIMARY_LIGHT %}--primary-light: {{ config.THEME_PRIMARY_LIGHT }};{% endif %}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endif %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue