Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dark-mode: Add a proposal for dark mode extension icons #585

Merged
merged 56 commits into from
May 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
2a58213
dark-mode: Add a proposal for dark mode extension icons
solomonkinard Apr 5, 2024
9d65c2f
dark-mode: Add a proposal for dark mode extension icons
solomonkinard Apr 5, 2024
67b5762
dark-mode: Add a proposal for dark mode extension icons
solomonkinard Apr 5, 2024
447c704
dark-mode: Add a proposal for dark mode extension icons
solomonkinard Apr 5, 2024
7773648
dark-mode: Add a proposal for dark mode extension icons
solomonkinard Apr 5, 2024
3aa4866
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 9, 2024
b0ce301
dark-mode: Add a proposal for dark mode extension icons
solomonkinard Apr 9, 2024
5826697
dark-mode: Add a proposal for dark mode extension icons
solomonkinard Apr 9, 2024
dc86a8a
main: Format FAQ
solomonkinard Apr 9, 2024
b4504c1
Use TypeScript where possible in the schema and reinvented ImageData
solomonkinard Apr 10, 2024
c398b05
main: Add an option in the case that neither icon nor light mode exist
solomonkinard Apr 10, 2024
fc9a84e
main: Incorporate ideas from the meeting and the review comments
solomonkinard Apr 12, 2024
45c4448
Addressed comments in the thread and removed options with no attention
solomonkinard Apr 18, 2024
cc24421
Include any in manifest.json and use the same style
solomonkinard Apr 18, 2024
0bc8701
Include array of {"color_scheme": ["dark", "light"]} to cover all cases
solomonkinard Apr 19, 2024
29be8c9
Removed TODO
solomonkinard Apr 19, 2024
5fe0b84
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 19, 2024
dae3dec
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 19, 2024
e577b20
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 19, 2024
f3ab3cf
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 19, 2024
bf6d0ea
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 19, 2024
c76a737
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 19, 2024
27e1fc5
Address comments
solomonkinard Apr 19, 2024
96ffdef
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 23, 2024
6773528
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 23, 2024
5b1c668
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 23, 2024
bfc0f75
main: Line wrap and nest bullets
solomonkinard Apr 23, 2024
e3f3c28
main: Addressed remaining comments
solomonkinard Apr 23, 2024
6e6af62
main: Flesh out more defined behavior for a myriad of cases
solomonkinard Apr 24, 2024
9f15f4c
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 24, 2024
4a514e6
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 24, 2024
47c80c2
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 24, 2024
f78f34b
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 24, 2024
96613e3
Apply suggestions from code review
solomonkinard Apr 24, 2024
58017e1
Apply suggestions from code review
solomonkinard Apr 24, 2024
8345783
Apply suggestions from code review
solomonkinard Apr 25, 2024
da8166f
Apply suggestions from code review
solomonkinard Apr 25, 2024
3f70cb4
Addressed comment
solomonkinard Apr 25, 2024
da5db34
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 26, 2024
f6567e0
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 29, 2024
d2d9daa
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 29, 2024
ee129e8
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 29, 2024
c7583cc
Apply an unclickable outdated commit, line wrap, and organize rules
solomonkinard Apr 29, 2024
35f1c96
Include API in the heading
solomonkinard Apr 29, 2024
bc73bef
Pull in wording from the doc
solomonkinard Apr 29, 2024
bdbefd6
Added a summary and organized sections
solomonkinard Apr 29, 2024
25c570b
Labeled the summary
solomonkinard Apr 29, 2024
932ddf4
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 29, 2024
6f2fc51
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 29, 2024
2bf510f
Update proposals/dark_mode_extension_icons.md
solomonkinard Apr 29, 2024
c37fc62
Update proposals/dark_mode_extension_icons.md
solomonkinard May 1, 2024
c815458
Moved schema to examples, added a generic schema, and a comma
solomonkinard May 1, 2024
26a3ff2
Update proposals/dark_mode_extension_icons.md
solomonkinard May 9, 2024
7f82152
Removed the TypeScript section recommended by Simeon, for faster merge
solomonkinard May 9, 2024
e1b23de
Only one mime-type per icon group as per the conversation
solomonkinard May 9, 2024
86e7051
Clarify what happens if more than one type is present in an icon group
solomonkinard May 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 48 additions & 5 deletions proposals/dark_mode_extension_icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature to enable developers to enhance extension icon visibility in dark mode.

**Sponsoring Browser:** Chromium

**Contributors:** oliverdunk, xeenon, carlosjeurissen, hanguokai
**Contributors:** oliverdunk, xeenon, carlosjeurissen, hanguokai, dotproto

**Created:** 2024-04-05

Expand Down Expand Up @@ -45,6 +45,44 @@ The Chromium bug has a significant amount of developer interest.

### Schema

manifest.json
```
type ImagePath = string;
type ColorScheme = "light" | "dark";

interface IconVariantsBase {
color_scheme?: ColorScheme | ColorScheme[];
}

interface IconVariantsManifest extends IconVariantsBase {
any?: ImagePath;
solomonkinard marked this conversation as resolved.
Show resolved Hide resolved
[index: number]: ImagePath;
}

interface ManifestAction {
[icon_variants: string]: IconVariantsManifest;
solomonkinard marked this conversation as resolved.
Show resolved Hide resolved
}

interface ExtensionManifest {
icon_variants: IconVariantsManifest[];
action: Action;
solomonkinard marked this conversation as resolved.
Show resolved Hide resolved
}
```

action.setIcon
```
interface SetIconVariantsApiDetails extends IconVariantsBase {
any?: ImagePath | ImageData;
[index: number]: ImagePath | ImageData;
}

interface SetIconVariantsApi {
[variants: string]: ActionIconVariants;
solomonkinard marked this conversation as resolved.
Show resolved Hide resolved
}
```

### Examples

manifest.json
```
"icon_variants": [
Expand All @@ -65,7 +103,10 @@ manifest.json
"32": "light32.png",
"color_scheme": ["dark", "light"]
}
]
],
"action": {
"icon_variants": [...]
}
```
`icon_variants` requires an array with a set of icon groups objects. Each icon
group consists of a set of icon paths and icon group matching criteria.
Expand Down Expand Up @@ -185,7 +226,9 @@ warning. For example, `color_scheme: ["unknown"]` will be treated as an empty
array. An empty array means the browser should mark the icon group as invalid
and ignore it.
1. If only one icon object is defined with a specific color scheme, that icon
object will be applied to all color schemes. It will be the icon used.
object will be applied to all color schemes.
1. **Fuzzy matching** Inexact size matches will return the icon closest in size,
starting with smaller sizes if available, retreating to the nearest larger size.

**Size**
1. The `"16"` is a size in `{"16": "icon.png"}` and any number can be used as a
Expand All @@ -199,7 +242,7 @@ the next largest pixel size or `"any"` will be used.
1. **Vector images**: Sizes are in points, ensuring device independence. If the
exact point size is unavailable, an integer multiple (e.g. 32, 48, etc.) or
`"any"` will be used.
* If none of the specified icon groups have matching criteria, browsers should
1. If none of the specified icon groups have matching criteria, browsers should
drop matching criteria in a specified order until it finds a group which results
in a match. It will start by dropping any matching criteria which are
unsupported/unknown. If still no match could be made, it will drop known
Expand All @@ -213,7 +256,7 @@ action. If not specified, it falls back to default_icon, then to the top-level
`icon_variants` or icons.
1. `action.setIcon({variants})` will not throw when giving it icon groups with
properties it does not understand. Those icon groups will simply be ignored for
making matches. If however none of the icon groups are supported, an exception
making matches. If however, none of the icon groups are supported, an exception
will be thrown allowing both feature detection and specifying fallbacks without
requiring feature detection.

solomonkinard marked this conversation as resolved.
Show resolved Hide resolved
solomonkinard marked this conversation as resolved.
Show resolved Hide resolved
solomonkinard marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading