Skip to content

Commit

Permalink
Merge pull request #2818 from roed314/color_settings
Browse files Browse the repository at this point in the history
Color settings
  • Loading branch information
jwj61 committed Mar 21, 2019
2 parents d60eb9f + 4cf9c9d commit f3bc9ee
Show file tree
Hide file tree
Showing 41 changed files with 618 additions and 1,171 deletions.
11 changes: 6 additions & 5 deletions Development.md
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
Expand Up @@ -416,11 +416,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,5 +1,4 @@
{% extends "homepage.html" %}
{% import 'color.css' as color %}
{% block content %}
<div>
{{ KNOWL_INC('dq.st.extent') }}
Expand Down
@@ -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
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
@@ -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
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
@@ -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
@@ -1,5 +1,4 @@
{% extends 'homepage.html' %}
{% import 'color.css' as color %}
{% block content %}

<p>
Expand Down

0 comments on commit f3bc9ee

Please sign in to comment.