From 1a0696df37bd2feaca1af68e89fb9c140ab773b8 Mon Sep 17 00:00:00 2001 From: lionel-rowe Date: Sat, 23 Apr 2022 00:22:28 +0100 Subject: [PATCH] Make default CSS easily configurable/overridable --- .../event/overall_header_head_append.html | 4 +++- .../viewtopic_body_post_buttons_after.html | 2 +- .../event/viewtopic_topic_title_append.html | 2 +- .../all/theme/{buttons.css => phpbb-3-1-x.css} | 0 styles/all/theme/styles.css | 18 ++++++++++++++++++ topicsolved.php | 12 +++++------- 6 files changed, 28 insertions(+), 10 deletions(-) rename styles/all/theme/{buttons.css => phpbb-3-1-x.css} (100%) create mode 100644 styles/all/theme/styles.css diff --git a/styles/all/template/event/overall_header_head_append.html b/styles/all/template/event/overall_header_head_append.html index 9d00f3f..fff8c75 100644 --- a/styles/all/template/event/overall_header_head_append.html +++ b/styles/all/template/event/overall_header_head_append.html @@ -1,3 +1,5 @@ - + + + diff --git a/styles/all/template/event/viewtopic_body_post_buttons_after.html b/styles/all/template/event/viewtopic_body_post_buttons_after.html index bf82de1..73421d7 100644 --- a/styles/all/template/event/viewtopic_body_post_buttons_after.html +++ b/styles/all/template/event/viewtopic_body_post_buttons_after.html @@ -8,7 +8,7 @@ - {L_SET_TOPIC_NOT_SOLVED} + {L_SET_TOPIC_NOT_SOLVED} diff --git a/styles/all/template/event/viewtopic_topic_title_append.html b/styles/all/template/event/viewtopic_topic_title_append.html index 6d05514..e74d99e 100644 --- a/styles/all/template/event/viewtopic_topic_title_append.html +++ b/styles/all/template/event/viewtopic_topic_title_append.html @@ -5,7 +5,7 @@ - + {TOPIC_SOLVED_IMAGE} {L_TOPIC_SOLVED} diff --git a/styles/all/theme/buttons.css b/styles/all/theme/phpbb-3-1-x.css similarity index 100% rename from styles/all/theme/buttons.css rename to styles/all/theme/phpbb-3-1-x.css diff --git a/styles/all/theme/styles.css b/styles/all/theme/styles.css new file mode 100644 index 0000000..1a6c509 --- /dev/null +++ b/styles/all/theme/styles.css @@ -0,0 +1,18 @@ +.topic_solved_title_link:hover { + text-decoration: none; +} + +.topic_solved_icon { + --hue: 120deg; + --sat: 100%; + --lightness: 37%; + color: hsl(var(--hue) var(--sat) var(--lightness)); +} + +.topic_solved_title_link .topic_solved_icon { + display: inline-flex; +} + +:is(.topic_solved_title_link, .list-inner a):hover .topic_solved_icon { + color: hsl(var(--hue) var(--sat) calc(var(--lightness) - 6%)); +} diff --git a/topicsolved.php b/topicsolved.php index a819531..efb0fb8 100644 --- a/topicsolved.php +++ b/topicsolved.php @@ -304,11 +304,8 @@ public function image($type, $alt = '', $url = '') public function icon($color = '', $alt = '', $url = '') { $title = ''; - if (empty($color)) - { - $color = '00BF00'; - } - $classes = 'fa fa-check-circle fa-fw'; + + $classes = 'topic_solved_icon fa fa-check-circle fa-fw'; /** * This event makes it possible to customize the solved icon. @@ -324,8 +321,9 @@ public function icon($color = '', $alt = '', $url = '') extract($this->dispatcher->trigger_event('tierra.topicsolved.render_icon', compact($vars))); $markup = sprintf( - '', - $classes, $color + '', + $classes, + empty($color) ? '' : "color: #$color" ); if (!empty($alt))