Open gitgud-software opened 8 years ago
Ah, good point, I'll need to think about how to handle this (or use your suggestion!).
Probably something similar to the PBL_IF_COLOR
macros in C would be preferable. In the mean time, you can use the undocumented Platform module:
var Platform = require('platform');
var color = Platform.version() === 'aplite' ? 'black' : 'blue';
The platform module was made for internal use, but I think it's very unlikely that usage would change. Its version
function is a tiny wrapper around Pebble.getActiveWatchInfo().platform
which is not always available.
This is incredibly helpful actually, I'm surprised it isn't in the documentation in the first place now that we have most applications building for multiple platforms. Glad to see that the support is there at least.
The current Aplite builds for pebblejs adapt colors and make decisions about them poorly. As demonstrated by the comparison above, it is not always in the best interest of the developer to let the choice of color scheme for Aplite be handled by the build script. Ideally, decisions regarding how the app looks in Aplite should be possible to determine as a separate attributes.
Color handling should only switch to defaults when an Aplite color attribute is not specified for an element.