diff --git a/app/assets/javascripts/discourse/app/components/category-logo.js b/app/assets/javascripts/discourse/app/components/category-logo.js index 742bb3c18ef..7ab722ae7bc 100644 --- a/app/assets/javascripts/discourse/app/components/category-logo.js +++ b/app/assets/javascripts/discourse/app/components/category-logo.js @@ -1,3 +1,19 @@ -import templateOnly from "@ember/component/template-only"; +import Component from "@glimmer/component"; +import { inject as service } from "@ember/service"; -export default templateOnly(); +export default class CategoryLogo extends Component { + @service session; + + get defaultCategoryLogo() { + // use dark logo by default in edge case + // when scheme is dark and dark logo is present + if ( + this.session.defaultColorSchemeIsDark && + this.args.category.uploaded_logo_dark + ) { + return this.args.category.uploaded_logo_dark; + } + + return this.args.category.uploaded_logo; + } +} diff --git a/app/assets/javascripts/discourse/app/templates/components/category-logo.hbs b/app/assets/javascripts/discourse/app/templates/components/category-logo.hbs index 8b67105bd79..1907f6b11ea 100644 --- a/app/assets/javascripts/discourse/app/templates/components/category-logo.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/category-logo.hbs @@ -2,7 +2,7 @@ {{#if (and @category.uploaded_logo.url @category.uploaded_logo_dark.url)}} - + {{else if @category.uploaded_logo.url}}