mirror of
https://github.com/flarum/core.git
synced 2025-08-30 11:30:21 +02:00
fix: TagTiles contrast
This commit is contained in:
@@ -4,6 +4,7 @@ import Link from 'flarum/common/components/Link';
|
|||||||
import LoadingIndicator from 'flarum/common/components/LoadingIndicator';
|
import LoadingIndicator from 'flarum/common/components/LoadingIndicator';
|
||||||
import listItems from 'flarum/common/helpers/listItems';
|
import listItems from 'flarum/common/helpers/listItems';
|
||||||
import humanTime from 'flarum/common/helpers/humanTime';
|
import humanTime from 'flarum/common/helpers/humanTime';
|
||||||
|
import getContrast from 'flarum/common/utils/getContrast';
|
||||||
|
|
||||||
import tagIcon from '../../common/helpers/tagIcon';
|
import tagIcon from '../../common/helpers/tagIcon';
|
||||||
import tagLabel from '../../common/helpers/tagLabel';
|
import tagLabel from '../../common/helpers/tagLabel';
|
||||||
@@ -58,7 +59,7 @@ export default class TagsPage extends Page {
|
|||||||
const children = sortTags(tag.children() || []);
|
const children = sortTags(tag.children() || []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li className={'TagTile ' + (tag.color() ? 'colored' : '')} style={{ '--tag-bg': tag.color() }}>
|
<li className={'TagTile ' + (tag.color() ? 'colored ' : '') + (getContrast(tag.color()) >= 128 ? 'tag-light' : 'tag-dark')} style={{ '--tag-bg': tag.color() }}>
|
||||||
<Link className="TagTile-info" href={app.route.tag(tag)}>
|
<Link className="TagTile-info" href={app.route.tag(tag)}>
|
||||||
{tag.icon() && tagIcon(tag, {}, { useColor: false })}
|
{tag.icon() && tagIcon(tag, {}, { useColor: false })}
|
||||||
<h3 className="TagTile-name">{tag.name()}</h3>
|
<h3 className="TagTile-name">{tag.name()}</h3>
|
||||||
|
@@ -63,8 +63,25 @@
|
|||||||
color: @control-color;
|
color: @control-color;
|
||||||
}
|
}
|
||||||
&.colored {
|
&.colored {
|
||||||
&, a {
|
&.tag-light {
|
||||||
color: @body-bg;
|
&, a {
|
||||||
|
color: @text-color;
|
||||||
|
}
|
||||||
|
& when (@config-dark-mode = true) {
|
||||||
|
&, a {
|
||||||
|
color: @body-bg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.tag-dark {
|
||||||
|
&, a {
|
||||||
|
color: @body-bg;
|
||||||
|
}
|
||||||
|
& when (@config-dark-mode = true) {
|
||||||
|
&, a {
|
||||||
|
color: @text-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user