1
0
mirror of https://github.com/flarum/core.git synced 2025-08-15 12:54:47 +02:00

fix: DiscussionHero contrast

This commit is contained in:
protoclown
2022-09-29 16:26:43 +02:00
parent 6903b84605
commit bb0f3eab74
2 changed files with 24 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
import { extend } from 'flarum/common/extend';
import DiscussionListItem from 'flarum/forum/components/DiscussionListItem';
import DiscussionHero from 'flarum/forum/components/DiscussionHero';
import isDark from 'flarum/common/utils/isDark';
import tagsLabel from '../common/helpers/tagsLabel';
import sortTags from '../common/utils/sortTags';
@@ -23,7 +24,13 @@ export default function () {
const color = tags[0].color();
if (color) {
view.attrs.style = { '--hero-bg': color };
view.attrs.className += ' DiscussionHero--colored';
if (isDark(color)) {
view.attrs.className += ' DiscussionHero--dark';
}
else {
view.attrs.className += ' DiscussionHero--light';
}
}
}
});

View File

@@ -42,13 +42,25 @@
&.colored {
--tag-color: var(--tag-bg);
margin-right: 5px;
background: @body-bg !important;
}
&.tag-light {
background: @text-on-light !important;
}
&.tag-dark {
background: @text-on-dark !important;
}
}
}
.DiscussionHero--colored {
.DiscussionHero {
&--light {
&, a {
color: @body-bg;
color: @text-on-light;
}
}
&--dark {
&, a {
color: @text-on-dark;
}
}
}
.TagsLabel {