Change colors in editor depending on environment theme

Resolves MS-712 #complete
This commit is contained in:
Ramon Wenger 2023-05-11 16:29:03 +02:00
parent 13c11c984d
commit 7640db402d
2 changed files with 18 additions and 2 deletions

View File

@ -25,6 +25,7 @@ TEST = "test" in sys.argv
ENABLE_SILKY = bool_value(os.environ.get("ENABLE_SILKY", ""))
SERVE_VIA_WEBPACK = bool_value(os.environ.get("SERVE_VIA_WEBPACK", DEBUG))
ENABLE_SENTRY = not DEBUG or bool_value(os.environ.get("ENABLE_SENTRY_DEBUG", ""))
THEME = os.environ.get("THEME", "skillbox")
ALLOWED_HOSTS = ["*"]

View File

@ -13,9 +13,24 @@ from books.models import ContentBlockSnapshot
from books.models.chapter import Chapter
from books.models.contentblock import ContentBlock
from core.logger import get_logger
from django.conf import settings
logger = get_logger(__name__)
theme = settings.THEME
if theme == "my-kv":
primary = "#2075ff"
secondary = "#0ca87d"
elif theme == "my-dha":
primary = "#1bab4e"
secondary = "#139ee0"
elif theme == "my-dhf":
primary = "#139ee0"
secondary = "#1bab4e"
else:
primary = "#17A887"
secondary = "#078CC6"
# 1. Use the register_rich_text_features hook.
@hooks.register("register_rich_text_features")
@ -32,7 +47,7 @@ def register_brand_feature(features):
"type": type_,
"label": "Auszeichung Primär",
"description": "Auszeichung Primär",
"style": {"color": "#17A887", "font-weight": "600"},
"style": {"color": primary, "font-weight": "600"},
}
# 3. Call register_editor_plugin to register the configuration for Draftail.
@ -70,7 +85,7 @@ def register_secondary_feature(features):
"type": type_,
"label": "Auszeichnung sekundär",
"description": "Auszeichnung sekundär",
"style": {"color": "#078CC6", "font-weight": "600"},
"style": {"color": secondary, "font-weight": "600"},
}
# 3. Call register_editor_plugin to register the configuration for Draftail.