-
Notifications
You must be signed in to change notification settings - Fork 79
Description
Introduction
Considering the preference for declarative declaration of theme data for smooth light / dark theme transitions as discussed in #869, having a way to specify both dark and light versions of the badge theme would be very welcome.
Before proceeding with a proposal doc, wanted to hear from the group what direction to head into.
With both proposal A and B, both the text color and background colors are set at the same time. Requesting to specify both of them at the same time can reduce potential contrast issues and visual glitches due to two API calls being required.
Proposal A - variant list
This API design would utilise a similar concept as we have been using for icon_variants. In which you pass a set of potential variations which include both the data to set as well as the required filter matches.
Example same for all themes
browser.action.setBadgeStyle([{
textColor: '#000000',
backgroundColor: '#ffffff',
}]);Example different per colorScheme
browser.action.setBadgeStyle([{
textColor: '#ffffff',
backgroundColor: '#000000',
colorSchemes: ['dark'],
}, {
textColor: '#000000',
backgroundColor: '#ffffff',
}]);Proposal B - nested objects
Example same for all themes
browser.action.setBadgeStyle({
textColor: '#ffffff',
backgroundColor: '#000000',
});Example different per colorScheme
browser.action.setBadgeStyle({
light: {
textColor: '#ffffff',
backgroundColor: '#000000',
},
dark: {
textColor: '#000000',
backgroundColor: '#ffffff',
},
});Proposal C - setIcon approach with tabId and windowId support
browser.action.setBadgeStyle({
textColor: '#000000',
backgroundColor: '#ffffff',
tabId: 200,
});and separate variants per color scheme:
browser.action.setBadgeStyle({
tabId: 200,
variants: [{
textColor: '#ffffff',
backgroundColor: '#000000',
colorSchemes: ['dark'],
}, {
textColor: '#000000',
backgroundColor: '#ffffff',
}]
});Conclusion
These APIs would have the potential to replace the action.setBadgeBackgroundColor and action.setBadgeTextColor APIs.
Each proposal have different pros and cons in terms of flexibility, understandability and their future-proof aspect. So love to hear from the group what your thoughts are.