mirror of https://github.com/JohnHammond/CTFd.git
Fix custom theme color setting in config panel (#1268)
* Properly update the theme header with custom theme color values * Closes #1263bulk-clear-sessions
parent
2f46f61ed0
commit
e764bb16b8
|
@ -245,18 +245,20 @@ $(() => {
|
|||
$(".nav-pills a").click(showTab);
|
||||
$("#config-color-update").click(function() {
|
||||
const hex_code = $("#config-color-picker").val();
|
||||
const user_css = $("#css-editor").val();
|
||||
const user_css = $("#theme-header").val();
|
||||
let new_css;
|
||||
if (user_css.lenth) {
|
||||
if (user_css.length) {
|
||||
let css_vars = `theme-color: ${hex_code};`;
|
||||
new_css = user_css.replace(/theme-color: (.*);/, css_vars);
|
||||
} else {
|
||||
new_css =
|
||||
`<style id="theme-color">\n` +
|
||||
`:root {--theme-color: ${hex_code};}\n` +
|
||||
`.navbar{background-color: var(--theme-color) !important;}\n` +
|
||||
`.jumbotron{background-color: var(--theme-color) !important;}\n`;
|
||||
`.jumbotron{background-color: var(--theme-color) !important;}\n` +
|
||||
`</style>\n`;
|
||||
}
|
||||
$("#css-editor").val(new_css);
|
||||
$("#theme-header").val(new_css);
|
||||
});
|
||||
|
||||
$(".start-date").change(function() {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue