Fix custom theme color setting in config panel (#1268)

* Properly update the theme header with custom theme color values 
* Closes #1263
bulk-clear-sessions
Kevin Chung 2020-02-29 16:56:05 -05:00 committed by GitHub
parent 2f46f61ed0
commit e764bb16b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -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