elementary / appcenter

Pay-what-you-can app store for elementary OS
https://elementary.io
GNU General Public License v3.0
541 stars 100 forks source link

Theme specific branding colors #2140

Open razzeee opened 2 months ago

razzeee commented 2 months ago

Problem

It seems like appcenter will always take the branding color without a scheme

https://github.com/elementary/appcenter/blob/f8db5192b69da0846fa9e62f789e15e0dbf0cf29/src/Core/Package.vala#L826

(I might just no be understanding vala)

Flathub apps will almost always have a scheme_preference that should be read instead. Those will look similar to the spec https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-branding

    <branding>
      <color type="primary" scheme_preference="light">#ff00ff</color>
      <color type="primary" scheme_preference="dark">#993d3d</color>
    </branding>

But you would also need to handle

    <branding>
      <color type="primary" scheme_preference="light">#ff00ff</color>
      <color type="primary">#993d3d</color>
    </branding>

And this one, that's probably already working

    <branding>
      <color type="primary">#993d3d</color>
    </branding>

If this is not done, we might run into comparability problems.

For e.g. we had an app with the following (kinda nonsensical definition)

<branding>
    <color type="primary">#f9c440</color>
    <color type="primary" scheme_preference="light">#d48e15</color>
    <color type="primary" scheme_preference="dark">#ffe16b</color>
  </branding>

Presumably cause they wanted it to work in flathub and appcenter.

https://github.com/ryonakano/konbucase/pull/128#issuecomment-2034641821

Proposal

Parse all branding colors from appstream including the scheme_preference

Prior Art (Optional)

No response

ausdauerer commented 1 month ago

Hey, can i work on this issue? Thanks

danirabbit commented 1 month ago

@ausdauerer feel free to propose a branch! Thanks :pink_heart: