diff --git a/celery_progress/static/celery_progress/celery_progress.js b/celery_progress/static/celery_progress/celery_progress.js index 0a93845..0d957db 100644 --- a/celery_progress/static/celery_progress/celery_progress.js +++ b/celery_progress/static/celery_progress/celery_progress.js @@ -22,13 +22,7 @@ class CeleryProgressBar { this.onHttpError = options.onHttpError || this.onError; this.pollInterval = options.pollInterval || 500; // Other options - let barColorsDefault = { - success: '#76ce60', - error: '#dc4f63', - progress: '#68a9ef', - ignored: '#7a7a7a' - } - this.barColors = Object.assign({}, barColorsDefault, options.barColors); + this.barColors = Object.assign({}, this.getBarColorsDefault(), options.barColors); let defaultMessages = { waiting: 'Waiting for task to start...', @@ -169,6 +163,15 @@ class CeleryProgressBar { this.onHttpError(this.progressBarElement, this.progressBarMessageElement, "HTTP Code " + response.status, response); } } + + static getBarColorsDefault() { + return { + success: '#76ce60', + error: '#dc4f63', + progress: '#68a9ef', + ignored: '#7a7a7a' + }; + } static initProgressBar(progressUrl, options) { const bar = new this(progressUrl, options);