Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color settings #2818

Merged
merged 5 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ The idea is to extend "homepage.html" and replace the content block:
CSS
---
The css should be kept in the .css files in lmfdb/templates/ and loaded into
homepage.html. Preferably, new css should be added to one of the already existing .css files. There are two .css files:
homepage.html. Preferably, new css should be added to:
* style.css - contains the majority of the css, for exmaple, for the
properties and sidebar variables.
* color.css - contains all color definitions and templates. Always use a
color defined in color.css, preferably one of the col_main's. If you
feel the need to use a color not defined here, please add it to this file.
This helps keep the colors organized into a particular themes.

The colors are defined in `lmfdb.utils.color`, and are available in
Jinja as `color.header_background` for example. Please use the colors
defined there rather than specific colors so that the user can change
the color theme.

Code Organization / Blueprints
------------------------------
Expand Down
25 changes: 22 additions & 3 deletions lmfdb/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,30 @@ def robots_txt():
def humans_txt():
return render_template("acknowledgment.html", title="Acknowledgments")

@app.context_processor
def add_colors():
from lmfdb.utils.color import all_color_schemes
color = request.args.get('color')
if color and color.isdigit():
color = int(color)
if color not in all_color_schemes:
color = None
if color is None:
from flask_login import current_user
userid = current_user.get_id()
if userid is not None:
from lmfdb.users.pwdmanager import userdb
color = userdb.lookup(userid).get('color_scheme')
if color not in all_color_schemes:
color = None
if color is None:
from lmfdb.utils.config import Configuration
color = Configuration().get_color()
return dict(color=all_color_schemes[color].dict())

@app.route("/style.css")
def css():
from lmfdb.utils.config import Configuration
color = Configuration().get_color()
response = make_response(render_template("style.css", color_template=color))
response = make_response(render_template("style.css"))
response.headers['Content-type'] = 'text/css'
# don't cache css file, if in debug mode.
if current_app.debug:
Expand Down
1 change: 0 additions & 1 deletion lmfdb/belyi/templates/belyi_galmap.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}

<style>
Expand Down
1 change: 0 additions & 1 deletion lmfdb/characters/templates/CharacterGroupTable.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}

<style type="text/css">
Expand Down
1 change: 0 additions & 1 deletion lmfdb/characters/templates/CharacterTable.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}

<style type="text/css">
Expand Down
2 changes: 0 additions & 2 deletions lmfdb/characters/templates/Charpage.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}

{% block content %}

<style>
Expand Down
1 change: 0 additions & 1 deletion lmfdb/characters/templates/ConductorList.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}

<style type="text/css">
Expand Down
2 changes: 0 additions & 2 deletions lmfdb/characters/templates/ModulusList.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}

{% block content %}

<style type="text/css">
Expand Down
2 changes: 0 additions & 2 deletions lmfdb/characters/templates/OrderList.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}

{% block content %}

<style type="text/css">
Expand Down
2 changes: 0 additions & 2 deletions lmfdb/characters/templates/character_search.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}

{% block content %}

<style type="text/css">
Expand Down
1 change: 0 additions & 1 deletion lmfdb/elliptic_curves/templates/ec-isoclass.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}

{{ place_code('class') }}
Expand Down
1 change: 0 additions & 1 deletion lmfdb/genus2_curves/templates/g2c_curve.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}
<style>
<div.ratpts>span { white-space: nowrap; font-family: serif; }
Expand Down
1 change: 0 additions & 1 deletion lmfdb/hecke_algebras/templates/hecke_algebras-index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends "homepage.html" %}
{% import 'color.css' as color %}
{% block content %}
{% if BETA %}
<div>
Expand Down
3 changes: 0 additions & 3 deletions lmfdb/inventory_app/templates/inv_style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

{% import 'color.css' as color %}


.inventory_form { display: table;}
.inventory_row { display: table-row; }
.inventory_row > label{
Expand Down
1 change: 0 additions & 1 deletion lmfdb/knowledge/templates/knowl-edit.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends "homepage.html" %}
{% import 'color.css' as color %}
{% block content %}

{% if lock %}
Expand Down
1 change: 0 additions & 1 deletion lmfdb/knowledge/templates/knowl-index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends "homepage.html" %}
{% import 'color.css' as color %}
{% block content -%}
<style type="text/css">
a.curcat {
Expand Down
1 change: 0 additions & 1 deletion lmfdb/lattice/templates/lattice-index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends "homepage.html" %}
{% import 'color.css' as color %}
{% block content %}
<div>
{{ KNOWL_INC('dq.lattice.extent') }}
Expand Down
1 change: 0 additions & 1 deletion lmfdb/lfunctions/templates/Lfunction.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}

<script>
Expand Down
1 change: 0 additions & 1 deletion lmfdb/modlmf/templates/modlmf-index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends "homepage.html" %}
{% import 'color.css' as color %}
{% block content %}
<div>
{{ KNOWL_INC('dq.modlmf.extent') }}
Expand Down
1 change: 0 additions & 1 deletion lmfdb/rep_galois_modl/templates/rep_galois_modl-index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends "homepage.html" %}
{% import 'color.css' as color %}
{% block content %}
<div>
{{ KNOWL_INC('dq.rep_galois_modl.extent') }}
Expand Down
1 change: 0 additions & 1 deletion lmfdb/sato_tate_groups/templates/st_browse.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends "homepage.html" %}
{% import 'color.css' as color %}
{% block content %}
<div>
{{ KNOWL_INC('dq.st.extent') }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}

<p>Below are the dimensions of spaces of {{KNOWL("mf.siegel.vector_valued",title="vector valued Siegel modular forms")}} with full {{KNOWL("group.sp2gr",title="$\mathrm{Sp}(4, \mathbb{Z})$")}} level structure.</p>
Expand Down
3 changes: 1 addition & 2 deletions lmfdb/static/markitup.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// markItUp! Universal MarkUp Engine, JQuery plugin
// By Jay Salvat - http://markitup.jaysalvat.com/
// ------------------------------------------------------------------*/
{% import 'color.css' as color %}
.markItUp * {
margin:0px; padding:0px;
outline:none;
Expand Down Expand Up @@ -145,4 +144,4 @@
.wiki .markItUpEditor,
.dotclear .markItUpEditor {
background-image:url(images/bg-editor-wiki.png);
}
}
1 change: 0 additions & 1 deletion lmfdb/templates/acknowledgment.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}
<style>
#contribs { overflow: hidden; }
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% else %}
<title>LMFDB{% if title %} - {{ title|striptags }}{% endif %} </title>
{% endif %}
<link href="{{ url_for('css') }}" rel="stylesheet" type="text/css" />
<link id="style_css" href="{{ url_for('css') }}" rel="stylesheet" type="text/css" />

<!-- jQuery -->
<script type="text/javascript"
Expand Down
1 change: 0 additions & 1 deletion lmfdb/templates/citation.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}

<div>
Expand Down
1 change: 0 additions & 1 deletion lmfdb/templates/citations.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}

<p>
Expand Down
Loading