w3c / battery

Battery Status API
https://www.w3.org/TR/battery-status/
Other
24 stars 15 forks source link

dark mode #56

Closed jimmywarting closed 1 year ago

jimmywarting commented 1 year ago

Could you add a dark theme to https://www.w3.org/TR/battery-status? it's currently very bright

anssiko commented 1 year ago

@jimmywarting thanks for raising this issue. This spec is authored with ReSpec.js and that tool is currently lacking dark mode support. You can voice your support for this feature in https://github.com/w3c/respec/issues/2651 (or even submit a PR to implement this feature in that tool). Some specs are authored with another tool, Bikeshed, that does have dark mode support, so you may see some other specs go dark.

Once implemented this spec will automatically "go dark" (no pun intended), so I'm closing this issue with an expectation you'll track the feature development through the mentioned issue.

While you're here, please feel free to check out https://github.com/w3c/battery/blob/gh-pages/energy-saver-mode-explainer.md that was initiated based on your proposal and submit any feedback via https://github.com/w3c/battery/issues/9. We appreciate your continued contributions in this space.

jimmywarting commented 1 year ago

Looks grate!

some nit pick, while reading this code example:

let b = await navigator.getBattery();

if (b.energySaverMode) {
    saveEnergy();
}

b.energysavermodechange = () => {
    if (this.energySaverMode) saveEnergy();
}

I could not help but thinking: Hmm is energySaverMode a string or not? feels like energySaverMode could be either a "on" or "off" and not a boolean

I don't know how i feel about the r in saver at the end... just using save is good enough.

I like android / MacOS / iOS naming convention better.

It's a clear indication that it's a boolean. an alternative name could be energySaveModeOn or shouldPreserveEnergy or how about using b.prefersEnergySaving in javascript as well? i would kind of like it if js & css had similar naming convention. i think i might like prefersEnergySaving the most.

also this code example:

- b.energysavermodechange = () => {
+ battery.onenergysavermodechange = () => {
    if (this.energySaverMode) saveEnergy();
}
anssiko commented 1 year ago

Thanks for this great feedback, but please move it to #9 so it is in the right place 😀