diff --git a/assets/less/classes/changelog-actions-tags.less b/assets/less/classes/changelog-actions-tags.less index 4b0eb32c..e1829454 100644 --- a/assets/less/classes/changelog-actions-tags.less +++ b/assets/less/classes/changelog-actions-tags.less @@ -23,7 +23,7 @@ } &__entry { - color: inherit; + color: var(--user-colour); text-decoration: none; width: 200px; border: 1px solid var(--accent-colour); diff --git a/assets/less/classes/changelog.less b/assets/less/classes/changelog.less index c2486204..c482a2d3 100644 --- a/assets/less/classes/changelog.less +++ b/assets/less/classes/changelog.less @@ -49,7 +49,10 @@ &__datetime, &__user, &__action { - color: inherit; + --action-colour: inherit; + + background-color: var(--action-colour); + color: var(--user-colour); flex: 0 0 auto; margin-right: 1px; text-decoration: none; @@ -170,6 +173,7 @@ &__action { display: block; padding: 6px 2px; + background-color: var(--accent-colour); border-right: 1px solid var(--accent-colour); writing-mode: sideways-lr; text-orientation: sideways; @@ -234,6 +238,7 @@ } &__name { + color: var(--user-colour); font-size: 1.5em; line-height: 1.2em; } diff --git a/assets/less/classes/comment.less b/assets/less/classes/comment.less index ba819dc4..530c4b0a 100644 --- a/assets/less/classes/comment.less +++ b/assets/less/classes/comment.less @@ -136,6 +136,7 @@ } &__user { + color: var(--user-colour); font-weight: 700; text-decoration: none; diff --git a/assets/less/classes/forum/listing.less b/assets/less/classes/forum/listing.less index 8e4d56a3..9bfe868d 100644 --- a/assets/less/classes/forum/listing.less +++ b/assets/less/classes/forum/listing.less @@ -148,6 +148,7 @@ } &__user { + color: var(--user-colour); font-weight: 700; text-decoration: none; diff --git a/assets/less/classes/forum/post.less b/assets/less/classes/forum/post.less index c361ffe6..a605dd2e 100644 --- a/assets/less/classes/forum/post.less +++ b/assets/less/classes/forum/post.less @@ -103,6 +103,7 @@ } &__username { + color: var(--user-colour); font-size: 1.5em; line-height: 1.7em; } diff --git a/assets/less/classes/forum/topics.less b/assets/less/classes/forum/topics.less index 1798ff81..88093e1b 100644 --- a/assets/less/classes/forum/topics.less +++ b/assets/less/classes/forum/topics.less @@ -69,6 +69,7 @@ line-height: 1.2em; &__name { + color: var(--user-colour); font-weight: 700; text-decoration: none; diff --git a/assets/less/classes/header.less b/assets/less/classes/header.less index 005ab1c6..c9bc69ae 100644 --- a/assets/less/classes/header.less +++ b/assets/less/classes/header.less @@ -209,7 +209,8 @@ } &__name { - color: inherit; + color: var(--user-colour); + text-shadow: 0 0 5px var(--user-colour); font-size: 1.4em; line-height: 1.4em; font-family: @mio-font-heading; diff --git a/assets/less/classes/index.less b/assets/less/classes/index.less index 969a653a..19d5243a 100644 --- a/assets/less/classes/index.less +++ b/assets/less/classes/index.less @@ -27,7 +27,7 @@ } &__link { - color: inherit; + color: var(--user-colour); text-decoration: none; &:hover { diff --git a/assets/less/classes/news/post.less b/assets/less/classes/news/post.less index 622c47aa..6d07ced4 100644 --- a/assets/less/classes/news/post.less +++ b/assets/less/classes/news/post.less @@ -45,6 +45,7 @@ } &__username { + color: var(--user-colour); flex-grow: 1; flex-shrink: 1; font-weight: 700; diff --git a/assets/less/classes/news/preview.less b/assets/less/classes/news/preview.less index 10000289..80ec3326 100644 --- a/assets/less/classes/news/preview.less +++ b/assets/less/classes/news/preview.less @@ -52,5 +52,10 @@ width: 50px; margin-left: 4px; } + + &__name { + color: var(--user-colour); + text-shadow: 0 0 5px var(--user-colour); + } } } diff --git a/assets/less/classes/profile/header.less b/assets/less/classes/profile/header.less index 34ae714d..638bbb49 100644 --- a/assets/less/classes/profile/header.less +++ b/assets/less/classes/profile/header.less @@ -88,6 +88,8 @@ } &__username { + color: var(--user-colour); + text-shadow: 0 0 5px var(--user-colour); font-size: 2em; line-height: 1.5em; } diff --git a/assets/less/classes/usercard.less b/assets/less/classes/usercard.less index eae9e224..5987b3bd 100644 --- a/assets/less/classes/usercard.less +++ b/assets/less/classes/usercard.less @@ -92,6 +92,8 @@ } &__name { + color: var(--user-colour); + text-shadow: 0 0 5px var(--user-colour); font-size: 1.4em; line-height: 1.4em; text-overflow: ellipsis; diff --git a/assets/less/main.less b/assets/less/main.less index d34ca79f..4dde0bfb 100644 --- a/assets/less/main.less +++ b/assets/less/main.less @@ -15,6 +15,7 @@ --site-background-meta: no-repeat center / cover fixed; --site-background-image: initial; + --user-colour: inherit; --accent-colour: @default-accent-colour; --text-colour: @default-text-colour; --text-colour-inverted: color(#fff - @default-text-colour); diff --git a/src/comments.php b/src/comments.php index 58c43c66..418b59f1 100644 --- a/src/comments.php +++ b/src/comments.php @@ -58,10 +58,7 @@ function comments_parse_for_display(string $text): string return sprintf( '@%s', $info['user_id'], - html_colour($info['user_colour'], [ - 'color' => '%s', - 'text-shadow' => '0 0 5px %s', - ]), + html_colour($info['user_colour']), $info['username'] ); }, $text); diff --git a/templates/_layout/header.twig b/templates/_layout/header.twig index bfab47d5..ced82f8f 100644 --- a/templates/_layout/header.twig +++ b/templates/_layout/header.twig @@ -50,17 +50,12 @@
{% if current_user is defined %} - + {{ current_user.username }} {% else %} - + Guest {% endif %} diff --git a/templates/changelog/change.twig b/templates/changelog/change.twig index 37e3406b..482f8529 100644 --- a/templates/changelog/change.twig +++ b/templates/changelog/change.twig @@ -19,9 +19,9 @@ {% if is_valid %}
+ style="{{ change.action_colour|html_colour('--accent-colour'}) }}">
+ style="{{ change.action_colour|html_colour('--accent-colour') }}"> {{ change.action_name }}
diff --git a/templates/changelog/macros.twig b/templates/changelog/macros.twig index 5d006f1b..1c9b5c23 100644 --- a/templates/changelog/macros.twig +++ b/templates/changelog/macros.twig @@ -49,7 +49,7 @@ + {% if change.action_colour is defined %}style="{{ change.action_colour|html_colour('--action-colour') }}"{% endif %}>
{{ change.action_name|default('Unknown') }}
diff --git a/templates/forum/macros.twig b/templates/forum/macros.twig index ac3a14e6..f2d6555f 100644 --- a/templates/forum/macros.twig +++ b/templates/forum/macros.twig @@ -98,8 +98,7 @@
{% if forum.recent_post_user_id is not null %} - by {{ forum.recent_post_username }}, {% endif %} diff --git a/templates/manage/changelog/action_edit.twig b/templates/manage/changelog/action_edit.twig index 4e5c6e40..5c9b9b96 100644 --- a/templates/manage/changelog/action_edit.twig +++ b/templates/manage/changelog/action_edit.twig @@ -5,7 +5,7 @@

{% if edit_action is defined %} - Editing {{ edit_action.action_name }} ({{ edit_action.action_id }}) + Editing {{ edit_action.action_name }} ({{ edit_action.action_id }}) {% else %} Adding a new action {% endif %} diff --git a/templates/manage/changelog/actions_tags.twig b/templates/manage/changelog/actions_tags.twig index 06a1c0b8..1bddc8e7 100644 --- a/templates/manage/changelog/actions_tags.twig +++ b/templates/manage/changelog/actions_tags.twig @@ -34,7 +34,7 @@
{% for action in changelog_actions %} + style="{{ action.action_colour|html_colour('border-color') }}">
{{ action.action_name }} ({{ action.action_count }}) diff --git a/templates/manage/users/roles.twig b/templates/manage/users/roles.twig index 26054ed8..c7a15932 100644 --- a/templates/manage/users/roles.twig +++ b/templates/manage/users/roles.twig @@ -15,7 +15,7 @@
+ style="{{ role.role_colour|html_colour('background-color') }}">
diff --git a/templates/news/macros.twig b/templates/news/macros.twig index d74d9f89..51f49b5f 100644 --- a/templates/news/macros.twig +++ b/templates/news/macros.twig @@ -13,10 +13,7 @@ {% if post.user_id is not null %}
-
+
{{ post.username }}
diff --git a/templates/user/_layout/header.twig b/templates/user/_layout/header.twig index 68aeda8f..943680d8 100644 --- a/templates/user/_layout/header.twig +++ b/templates/user/_layout/header.twig @@ -3,10 +3,7 @@
-
+
{{ profile.username }}
diff --git a/templates/user/macros.twig b/templates/user/macros.twig index d41a8adc..55f81c89 100644 --- a/templates/user/macros.twig +++ b/templates/user/macros.twig @@ -11,10 +11,7 @@
+ {% if user.user_colour is defined %}style="{{ user.user_colour|html_colour }}"{% endif %}> {{ user.username }}
diff --git a/utility.php b/utility.php index d0c068bc..0a31cfa0 100644 --- a/utility.php +++ b/utility.php @@ -346,12 +346,21 @@ function html_link(string $url, ?string $content = null, $attributes = []): stri return $html; } -function html_colour(?int $colour, array $attribs = []): string +function html_colour(?int $colour, $attribs = '--user-colour'): string { $colour = $colour ?? colour_none(); + if (is_string($attribs)) { + $attribs = [ + $attribs => '%s', + ]; + } + if (!$attribs) { - $attribs['color'] = '%s'; + $attribs = [ + 'color' => '%s', + '--user-colour' => '%s', + ]; } $css = '';