Преглед изворни кода

Modify theme Courgette to add colors

Two colors are needed so I use a space in the cookie and a split in jinja to "encode" and "decode" them.
We should enforce that each theme if they must use a cookie, prefix its name with the name of the theme.

The color proposed here are based on bootstrap. We could use others.
Cqoicebordel пре 10 година
родитељ
комит
cd179bbdbb

+ 5
- 0
searx/templates/courgette/base.html Прегледај датотеку

@@ -8,6 +8,11 @@
8 8
         <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
9 9
         <title>{% block title %}{% endblock %}searx</title>
10 10
         <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
11
+        {% if cookies['courgette-color'] %}
12
+        <style type="text/css">
13
+        {% include 'courgette/color.css' %}
14
+        </style>
15
+        {% endif %}
11 16
         <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" />
12 17
         {% block styles %}
13 18
         {% endblock %}

+ 34
- 0
searx/templates/courgette/color.css Прегледај датотеку

@@ -0,0 +1,34 @@
1
+ .autocompleter-choices li:hover,
2
+.checkbox_container label:hover,
3
+.checkbox_container input[type="checkbox"]:checked + label,
4
+#sidebar,
5
+#suggestions input[type="submit"]:hover,
6
+#suggestions input[type="submit"]:focus,
7
+input[type="submit"],
8
+.engine_checkbox label,
9
+.engine_checkbox .deny,
10
+#search_submit{
11
+	background-color: {{ cookies['courgette-color'].split()[0] }};
12
+}
13
+
14
+.result_title a,
15
+.row a,
16
+.title h1{
17
+	color: {{ cookies['courgette-color'].split()[0] }};
18
+}
19
+
20
+#answers {
21
+	border-color: {{ cookies['courgette-color'].split()[0] }};
22
+}
23
+
24
+#search_submit:hover,
25
+#search_submit:focus,
26
+#sidebar input[type="submit"]:hover,
27
+#sidebar input[type="submit"]:focus {
28
+	background-color: {{ cookies['courgette-color'].split()[1] }};
29
+}
30
+
31
+input[type="submit"]:hover,
32
+input[type="submit"]:focus {
33
+	background: {{ cookies['courgette-color'].split()[1] }};
34
+}

+ 13
- 0
searx/templates/courgette/preferences.html Прегледај датотеку

@@ -70,6 +70,19 @@
70 70
         </p>
71 71
     </fieldset>
72 72
     <fieldset>
73
+        <legend>{{ _('Color') }}</legend>
74
+        <p>
75
+            <select name="courgette-color">
76
+                <option value="#3498DB #0665A2" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#3498DB #0665A2' %}selected="selected"{% endif %}>{{ _('Blue (default)') }}</option>
77
+                <option value="#6F5499 #563D7C" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#6F5499 #563D7C' %}selected="selected"{% endif %}>{{ _('Violet') }}</option>
78
+                <option value="#5CB85C #449D44" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#5CB85C #449D44' %}selected="selected"{% endif %}>{{ _('Green') }}</option>
79
+                <option value="#5BC0DE #31B0D5" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#5BC0DE #31B0D5' %}selected="selected"{% endif %}>{{ _('Cyan') }}</option>
80
+                <option value="#F0AD4E #EC971F" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#F0AD4E #EC971F' %}selected="selected"{% endif %}>{{ _('Orange') }}</option>
81
+                <option value="#D9534F #C9302C" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#D9534F #C9302C' %}selected="selected"{% endif %}>{{ _('Red') }}</option>
82
+            </select>
83
+        </p>
84
+    </fieldset>
85
+    <fieldset>
73 86
         <legend>{{ _('Currently used search engines') }}</legend>
74 87
 
75 88
         <table>