Is it possible to change the color of flask.flash
messages? The message is currently written in black and in very small characters.
Its easy one. first do not concentrate on styling the error message. If your flash message works then add the flash('your_message', category="your_error_argument") add the with_categories=True in template that's it.
Flask messages
takes optional argument called category
and use this to update template as you like.
flash('This is error message', 'error')
And in your html do remember to add with_categories
option
{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<div class="{{ category }}">{{ message }}</div>
{% endfor %}
{% endwith %}
Also please include this in your stylesheet
.error {
color: red
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With