Change flask_nav text color

Viewed 99

I implemented a navigation bar using Flask's flask_nav extension, however I can't do two things:

  • How can I put a new menu ("Connect" in this case) on the left side of the bar?

  • I can change the background color of the menu but not the text color, is this possible?

Here is the code:

  • From the .py file:
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask_nav import Nav
from flask_nav.elements import *
 
menus = Navbar("Menu", 
                View('Accueil', 'accueil'),
                View('A propos', 'apropos'),
                )
 
nav = Nav()
nav.register_element('top', menus)
app = Flask(__name__)
Bootstrap(app)

@app.route('/accueil')
def accueil():
    return render_template('accueil.html')
 
@app.route('/a-propos')
def apropos():
    return render_template('apropos.html')

nav.init_app(app)
 
if __name__ == '__main__':
    app.run(debug=True)
  • From the .html file monitoring the nav bar :
{% extends "bootstrap/base.html" %}
 
<!-- Gère la barre de menu -->
 
{% block styles %}
{{super()}}
 
<style>
 
.navbar-default {
    background-color: #333131;
    border-color: #333131;
}
 
</style>
 
{% endblock %}
 
{% block navbar %}
{{nav.top.render()}}
{% endblock %}

Thanks in advance

0 Answers
Related