diff --git a/about.json b/about.json
index 91cb513..06adabb 100644
--- a/about.json
+++ b/about.json
@@ -1,6 +1,6 @@
{
"name": "Versatile Banner",
"about_url": "https://meta.discourse.org/t/versatile-banner/109133",
- "license_url": "https://github.com/tshenry/discourse-versatile-banner/blob/master/LICENSE",
+ "license_url": "https://github.com/tshenry/discourse-versatile-banner/blob/main/LICENSE",
"component": true
}
diff --git a/common/color_definitions.scss b/common/color_definitions.scss
new file mode 100644
index 0000000..48fc9a1
--- /dev/null
+++ b/common/color_definitions.scss
@@ -0,0 +1,18 @@
+@function dark-if-set($dark, $light){
+ @if $dark != '' { @return $dark; }
+ @else { @return $light; }
+}
+
+$bg-color: dark-light-choose($background_color, dark-if-set($background_color_dark, $background_color));
+$primary-text: dark-light-choose($primary_text_color, dark-if-set($primary_text_color_dark, $primary_text_color));
+$secondary-text: dark-light-choose($secondary_text_color, dark-if-set($secondary_text_color_dark, $secondary_text_color));
+$link-text: dark-light-choose($link_text_color, dark-if-set($link_text_color_dark, $link_text_color));
+$bg-img: url(dark-light-choose($banner_background_image, dark-if-set($banner_background_image_dark, $banner_background_image)));
+
+:root {
+ --banner-bg-color: #{$bg-color};
+ --banner-primary-text: #{$primary-text};
+ --banner-secondary-text: #{$secondary-text};
+ --banner-link-text: #{$link-text};
+ --banner-bg-img: #{$bg-img};
+}
diff --git a/common/common.scss b/common/common.scss
index af1fa24..7a5bafb 100644
--- a/common/common.scss
+++ b/common/common.scss
@@ -49,13 +49,13 @@
max-width: calc(100% - 16px);
margin: 0 auto;
margin-top: 20px;
- color: $primary_text_color;
+ color: var(--banner-primary-text);
position: relative;
- background-image: url($banner_background_image);
+ background-image: var(--banner-bg-img);
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
- background-color: $background_color;
+ background-color: var(--banner-bg-color);
.button-container {
margin-right: 5px;
@@ -102,11 +102,11 @@
h2,
h3 {
text-align: center;
- color: $secondary_text_color;
+ color: var(--banner-secondary-text);
}
a {
- color: $link_text_color;
+ color: var(--banner-link-text);
}
.section-header {
@@ -121,7 +121,7 @@
margin: auto;
width: 165px;
height: 1px;
- background: $secondary_text_color;
+ background: var(--banner-secondary-text);
}
.description p {
@@ -144,7 +144,7 @@
.icon {
font-size: 70px;
- color: $secondary_text_color;
+ color: var(--banner-secondary-text);
.responsive-img {
vertical-align: -0.125em;
@@ -164,7 +164,7 @@
}
.btn.btn-icon-text {
- background: $secondary_text_color;
+ background: var(--banner-secondary-text);
}
}
}
diff --git a/settings.yml b/settings.yml
index db7f0b4..692baa5 100644
--- a/settings.yml
+++ b/settings.yml
@@ -1,50 +1,50 @@
show_for_members:
type: bool
default: true
- description:
+ description:
en: 'Display the banner for users logged into the forum'
show_for_anon:
type: bool
default: true
- description:
+ description:
en: 'Display the banner for anonymous users'
display_on_mobile:
type: bool
default: true
- description:
+ description:
en: 'Display the banner on mobile devices'
display_on_desktop:
type: bool
default: true
- description:
+ description:
en: 'Display the banner on desktop computers'
display_on_homepage:
type: bool
default: true
- description:
+ description:
en: 'Display the banner on the homepage'
url_must_contain:
type: list
list_type: simple
default: /latest|/categories|/new|/unread|/top*|/tag/*|/tags/*|/c/*|/t/*
- description:
+ description:
en: 'Enter paths that should display the banner. Add * to the end of the path as a wildcard'
dismissible:
type: bool
default: false
- description:
+ description:
en: 'Allow the banner to be closed by users'
collapsible:
type: bool
default: false
- description:
+ description:
en: 'Allow the banner to be expanded and collapsed by users'
default_collapsed_state:
type: enum
default: collapsed
choices:
- expanded
- description:
+ description:
en: 'Default collapsed state when collapsible setting is enabled'
cookie_lifespan:
type: enum
@@ -55,7 +55,7 @@ cookie_lifespan:
- week
- month
- year
- description:
+ description:
en: 'The lifespan of the cookie used to remember if the banner has been closed, expanded, or collapsed.
If set to "none", NO cookies will be used with this component, and any previously created cookies
related to the banner will be deleted the next time a user performs a full page load. The values are
@@ -63,12 +63,12 @@ cookie_lifespan:
cookie_name:
type: string
default: "v1"
- description:
+ description:
en: 'When important changes are made to the banner, you must change the cookie name to ensure all your users see the changes.'
full_width_banner:
type: bool
default: false
- description:
+ description:
en: 'Display the banner at full browser width'
swap_default_positioning:
type: bool
@@ -78,30 +78,55 @@ swap_default_positioning:
banner_background_image:
type: string
default: "https://i.imgur.com/k7SnZth.jpg"
- description:
+ description:
en: 'The source url for your background image. Tip: You can upload an image to your main theme and use the url from that,
but make sure that you do not use "Uploads" section of this component. Any uploads added to this component will be
deleted whenever it is updated.'
+banner_background_image_dark:
+ type: string
+ default: ""
+ description:
+ en: 'The source url for your background image when system dark mode is detected.'
background_color:
type: string
default: "#EED4A1"
- description:
+ description:
en: 'Used in place of a background image'
+background_color_dark:
+ type: string
+ default: ""
+ description:
+ en: 'Used in place of a background image when system dark mode is detected.'
primary_text_color:
type: string
default: "#000"
description:
en: 'The main text color of the banner'
+primary_text_color_dark:
+ type: string
+ default: ""
+ description:
+ en: 'The main text color of the banner when system dark mode is detected'
secondary_text_color:
type: string
default: "#FF6C00"
description:
en: 'The text color of the icon and text headings, and the button background color.'
+secondary_text_color_dark:
+ type: string
+ default: ""
+ description:
+ en: 'The text color of the icon and text headings, and the button background color when system dark mode is detected.'
link_text_color:
type: string
default: "#0f82af"
description:
- en: 'The text color links within the banner.
+ en: 'The text color of links within the banner.'
+link_text_color_dark:
+ type: string
+ default: ""
+ description:
+ en: 'The text color of links within the banner when system dark mode is detected.