Skip to content

Conversation

niemela
Copy link
Member

@niemela niemela commented Sep 15, 2025

Fixes #202

@deboer-tim
Copy link
Member

No concern with what's here so far, but I think we need an addition to the contest package format as well - otherwise there is no persistence of this data. We already added variant there, but needs to cover multiple variant strings, and currently same image variant is expected to be x.

@niemela
Copy link
Member Author

niemela commented Sep 15, 2025

No concern with what's here so far, but I think we need an addition to the contest package format as well - otherwise there is no persistence of this data.

There is persistence. You are always allowed to have a file reference object in the JSON files, and that would store the variant info.

We already added variant there,

Yes, and since that's not exactly the same thing, we probably should not call it the same?

but needs to cover multiple variant strings, and currently same image variant is expected to be x.

What do you think about saying that the variant may not include _, and that the "variant" (needs anew name) specified in the CPF is the WxH concatenated with all variants, separated by _. So, a 160x160 image suitable on light would be logo.160x160_light.png, and a 56x56 suitable on both would be logo.56x56_light_dark.png?

| mime | string | Mime type of resource.
| width | integer ? | Width of the image. Required for files with mime type image/\*.
| height | integer ? | Height of the image. Required for files with mime type image/\*.
| variant | array of string | Intended usage hints (e.g. `light`, `dark` for images).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm the only one, but I don't think variant is a good name here as to me it suggests that the options are mutually exclusive. Also, given that this is a list of options, I'd go for a plural terms, so for lack of better, I'd say tags.

@deboer-tim
Copy link
Member

No concern with what's here so far, but I think we need an addition to the contest package format as well - otherwise there is no persistence of this data.

There is persistence. You are always allowed to have a file reference object in the JSON files, and that would store the variant info.

Yes, but we often have files without json or incomplete json, so would be preferable to have both options, just like we do with x.

We already added variant there,

Yes, and since that's not exactly the same thing, we probably should not call it the same?

Agreed, and I'm ok with modifying either term.

but needs to cover multiple variant strings, and currently same image variant is expected to be x.

What do you think about saying that the variant may not include _,

+1

and that the "variant" (needs anew name) specified in the CPF is the WxH concatenated with all variants, separated by _. So, a 160x160 image suitable on light would be logo.160x160_light.png, and a 56x56 suitable on both would be logo.56x56_light_dark.png?

Generally, yes. We only say 'should' for the x so probably just the same thing here.

Variant is allowed to be anything today (and I think we want to keep that?) so I think server just looks for its known variants after splitting up the variant string by '_'.

Copy link
Member

@deboer-tim deboer-tim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few minor suggestions, but approving.

- `<property>` is the property of the object, e.g. `logo`.
- `(.<variant>)` is an optional variant. Must be used when there are
multiple files to avoid collisions.
- `(.<variant>)*` is one or several optional variant tags.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 'one or several' -> 'one or more'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had suggested "zero or more" (to correspond to the RE), and drop the optional part?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that works for me too.

- `light`: an image intended for use on white or light backgrounds.
- `dark`: an image intended for use on black or dark backgrounds.

An image may list both values if it is suitable for multiple contexts.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 'multiple contexts' -> 'both backgrounds' simpler?

For images, a variant of `.<W>x<H>`, is interpreted as the file reference object
having the `width` property set to `<W>` and the `height` property set to
`<H>`. Every other variant is interpreted as the file reference object having
the value its `variant` property array.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing 'in': 'the value in its'

@nickygerritsen nickygerritsen added this to the 2025-09 milestone Oct 13, 2025
@niemela
Copy link
Member Author

niemela commented Oct 13, 2025

Discussed on the meeting today. I will fix the outstanding comments and then merge. Comment if you disagree...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dark/light images

5 participants