colorway toggle

This commit is contained in:
ayaka 2025-01-06 07:15:24 +13:00
parent e478575706
commit 10c7327c39
5 changed files with 15 additions and 3 deletions

View File

@ -16,6 +16,8 @@ REDLIB_PUSHSHIFT_FRONTEND=undelete.pullpush.io
REDLIB_DEFAULT_THEME=system
# Set the default mascot
REDLIB_DEFAULT_MASCOT=none
# Enable showing redsublib colorway by default
REDLIB_DEFAULT_REDSUBLIB_COLORWAY=off
# Set the default front page (options: default, popular, all)
REDLIB_DEFAULT_FRONT_PAGE=default
# Set the default layout (options: card, clean, compact)

View File

@ -21,9 +21,10 @@ struct SettingsTemplate {
// CONSTANTS
const PREFS: [&str; 20] = [
const PREFS: [&str; 21] = [
"theme",
"mascot",
"redsublib_colorway",
"front_page",
"layout",
"wide",

View File

@ -607,6 +607,7 @@ pub struct Preferences {
pub available_mascots: Vec<String>,
pub theme: String,
pub mascot: String,
pub redsublib_colorway: String,
pub front_page: String,
pub layout: String,
pub wide: String,
@ -661,6 +662,7 @@ impl Preferences {
available_mascots: mascots,
theme: setting(req, "theme"),
mascot: setting(req, "mascot"),
redsublib_colorway: setting(req, "redsublib_colorway"),
front_page: setting(req, "front_page"),
layout: setting(req, "layout"),
wide: setting(req, "wide"),

View File

@ -40,7 +40,9 @@
<nav class="
{% if prefs.fixed_navbar == "on" %} fixed_navbar{% endif %}">
<div id="logo">
<a id="redlib" href="/"><span id="lib">red</span><span id="reddit">sun</span><span id="lib">lib.</span></a>
<a id="redlib" href="/">
<span id="lib" {% if prefs.redsublib_colorway == "on" %}style="color: #ff8585;"{% endif %}">red</span><span id="reddit" {% if prefs.redsublib_colorway == "on" %}style="color: #ffbfbf;"{% endif %}>sun</span><span id="lib" {% if prefs.redsublib_colorway == "on" %}style="color: #ff8585;"{% endif %}>lib.</span>
</a>
{% block subscriptions %}{% endblock %}
</div>
{% block search %}{% endblock %}

View File

@ -29,6 +29,11 @@
{% call utils::options(prefs.mascot, prefs.available_mascots, "system") %}
</select>
</div>
<div class="prefs-group">
<label for="redsublib_colorway">Force redsublib colorway</label>
<input type="hidden" value="off" name="redsublib_colorway">
<input type="checkbox" name="redsublib_colorway" {% if prefs.redsublib_colorway == "on" %}checked{% endif %}>
</div>
</fieldset>
<fieldset>
<legend>Interface</legend>
@ -153,7 +158,7 @@
</form>
<div id="settings_note">
<p><b>Note:</b> settings and subscriptions are saved in browser cookies. Clearing your cookies will reset them.</p><br>
<p>You can restore your current settings and subscriptions after clearing your cookies using <a href="/settings/restore/?theme={{ prefs.theme }}&mascot={{ prefs.mascot }}&front_page={{ prefs.front_page }}&layout={{ prefs.layout }}&wide={{ prefs.wide }}&post_sort={{ prefs.post_sort }}&comment_sort={{ prefs.comment_sort }}&show_nsfw={{ prefs.show_nsfw }}&use_hls={{ prefs.use_hls }}&ffmpeg_video_downloads={{ prefs.ffmpeg_video_downloads }}&hide_hls_notification={{ prefs.hide_hls_notification }}&hide_awards={{ prefs.hide_awards }}&fixed_navbar={{ prefs.fixed_navbar }}&hide_sidebar_and_summary={{ prefs.hide_sidebar_and_summary}}&subscriptions={{ prefs.subscriptions.join("%2B") }}&filters={{ prefs.filters.join("%2B") }}">this link</a>.</p>
<p>You can restore your current settings and subscriptions after clearing your cookies using <a href="/settings/restore/?theme={{ prefs.theme }}&mascot={{ prefs.mascot }}&redsublib_colorway={{ prefs.redsublib_colorway }}&front_page={{ prefs.front_page }}&layout={{ prefs.layout }}&wide={{ prefs.wide }}&post_sort={{ prefs.post_sort }}&comment_sort={{ prefs.comment_sort }}&show_nsfw={{ prefs.show_nsfw }}&use_hls={{ prefs.use_hls }}&ffmpeg_video_downloads={{ prefs.ffmpeg_video_downloads }}&hide_hls_notification={{ prefs.hide_hls_notification }}&hide_awards={{ prefs.hide_awards }}&fixed_navbar={{ prefs.fixed_navbar }}&hide_sidebar_and_summary={{ prefs.hide_sidebar_and_summary}}&subscriptions={{ prefs.subscriptions.join("%2B") }}&filters={{ prefs.filters.join("%2B") }}">this link</a>.</p>
</div>
{% if prefs.subscriptions.len() > 0 %}
<div class="prefs" id="settings_subs">